refactor modal animations and add more padding to the modal footer

This commit is contained in:
hippoz 2022-08-04 21:31:02 +03:00
parent 1feb79b2e8
commit 24a956c940
No known key found for this signature in database
GPG key ID: 7C52899193467641
10 changed files with 32 additions and 30 deletions

View file

@ -137,13 +137,13 @@ body {
}
.modal-header {
margin-bottom: var(--space-norm);
margin-bottom: var(--space-md);
text-align: center;
}
.modal-footer {
margin-top: auto;
padding-top: var(--space-norm);
padding-top: var(--space-lg);
}
.modal-primary-action {

View file

@ -1,6 +1,15 @@
import { fade, fly } from "svelte/transition";
import { cubicInOut } from "svelte/easing";
import { getItem } from "./storage";
export function maybeModalFade(node) {
return maybeFade(node, { duration: 160, easing: cubicInOut });
}
export function maybeModalFly(node) {
return maybeFly(node, { duration: 210, easing: cubicInOut, y: 15 });
}
export function maybeFly(...e) {
if (getItem("ui:doAnimations"))
return fly(...e);

View file

@ -1,9 +1,8 @@
<script>
import { quintInOut } from "svelte/easing";
import { overlayStore } from "../../stores";
import request from "../../request";
import { apiRoute } from "../../storage";
import { maybeFly } from "../../animations";
import { maybeModalFly } from "../../animations";
let username = "";
let password = "";
@ -58,7 +57,7 @@
</style>
<div class="modal-backdrop modal-backdrop-opaque" on:keydown="{ onKeydown }">
<div class="modal" transition:maybeFly="{{ duration: 300, easing: quintInOut, y: 10 }}" on:click|stopPropagation on:outroend="{ outroEnd }">
<div class="modal" transition:maybeModalFly on:click|stopPropagation on:outroend="{ outroEnd }">
<div class="modal-header">
<span class="h4">Create an Account</span>
</div>

View file

@ -1,9 +1,8 @@
<script>
import { quintInOut } from "svelte/easing";
import { overlayStore } from "../../stores";
import request from "../../request";
import { apiRoute } from "../../storage";
import { maybeFade, maybeFly } from "../../animations";
import { maybeModalFade, maybeModalFly } from "../../animations";
let channelName = "";
let createButtonEnabled = true;
@ -35,8 +34,8 @@
}
</style>
<div class="modal-backdrop" transition:maybeFade="{{ duration: 300, easing: quintInOut }}" on:click="{ close }" on:keydown="{ onKeydown }">
<div class="modal" transition:maybeFly="{{ duration: 300, easing: quintInOut, y: 10 }}" on:click|stopPropagation>
<div class="modal-backdrop" transition:maybeModalFade on:click="{ close }" on:keydown="{ onKeydown }">
<div class="modal" transition:maybeModalFly on:click|stopPropagation>
<div class="modal-header">
<span class="h4">Create Channel</span>
</div>

View file

@ -1,6 +1,5 @@
<script>
import { maybeFade, maybeFly } from "../../animations";
import { quintInOut } from "svelte/easing";
import { maybeModalFade, maybeModalFly } from "../../animations";
import { overlayStore } from "../../stores";
import request from "../../request";
import { apiRoute } from "../../storage";
@ -51,8 +50,8 @@
}
</style>
<div class="modal-backdrop" transition:maybeFade="{{ duration: 300, easing: quintInOut }}" on:click="{ close }" on:keydown="{ onKeydown }">
<div class="modal" transition:maybeFly="{{ duration: 300, easing: quintInOut, y: 10 }}" on:click|stopPropagation>
<div class="modal-backdrop" transition:maybeModalFade on:click="{ close }" on:keydown="{ onKeydown }">
<div class="modal" transition:maybeModalFly on:click|stopPropagation>
<div class="modal-header">
<span class="h4">Edit Channel</span>
</div>

View file

@ -3,7 +3,7 @@
import { overlayStore } from "../../stores";
import request from "../../request";
import { apiRoute } from "../../storage";
import { maybeFade, maybeFly } from "../../animations";
import { maybeModalFade, maybeModalFly } from "../../animations";
export let message;
@ -51,8 +51,8 @@
}
</style>
<div class="modal-backdrop" transition:maybeFade="{{ duration: 300, easing: quintInOut }}" on:click="{ close }" on:keydown="{ onKeydown }">
<div class="modal" transition:maybeFly="{{ duration: 300, easing: quintInOut, y: 10 }}" on:click|stopPropagation>
<div class="modal-backdrop" transition:maybeModalFade on:click="{ close }" on:keydown="{ onKeydown }">
<div class="modal" transition:maybeModalFly on:click|stopPropagation>
<div class="modal-header">
<span class="h4">Edit Message</span>
</div>

View file

@ -1,10 +1,9 @@
<script>
import { quintInOut } from "svelte/easing";
import { overlayStore } from "../../stores";
import request from "../../request";
import { apiRoute } from "../../storage";
import { authWithToken } from "../../auth";
import { maybeFly } from "../../animations";
import { maybeModalFly } from "../../animations";
let username = "";
let password = "";
@ -62,7 +61,7 @@
</style>
<div class="modal-backdrop modal-backdrop-opaque" on:keydown="{ onKeydown }">
<div class="modal" transition:maybeFly="{{ duration: 300, easing: quintInOut, y: 10 }}" on:click|stopPropagation on:outroend="{ outroEnd }">
<div class="modal" transition:maybeModalFly on:click|stopPropagation on:outroend="{ outroEnd }">
<div class="modal-header">
<span class="h4">Welcome back!</span>
</div>

View file

@ -1,6 +1,5 @@
<script>
import { maybeFade, maybeFly } from "../../animations";
import { quintInOut } from "svelte/easing";
import { maybeModalFade, maybeModalFly } from "../../animations";
import { overlayStore } from "../../stores";
export let onSubmit = async () => {};
@ -34,8 +33,8 @@
}
</style>
<div class="modal-backdrop" transition:maybeFade="{{ duration: 300, easing: quintInOut }}" on:click="{ close }" on:keydown="{ onKeydown }">
<div class="modal" transition:maybeFly="{{ duration: 300, easing: quintInOut, y: 10 }}" on:click|stopPropagation>
<div class="modal-backdrop" transition:maybeModalFade on:click="{ close }" on:keydown="{ onKeydown }">
<div class="modal" transition:maybeModalFly on:click|stopPropagation>
<div class="modal-header">
<span class="h4">{ heading }</span>
</div>

View file

@ -1,9 +1,8 @@
<script>
import { quintInOut } from "svelte/easing";
import { AtSignIcon } from "svelte-feather-icons";
import { overlayStore, userInfoStore, smallViewport, theme, doAnimations } from "../../stores";
import { logOut } from "../../auth";
import { maybeFade, maybeFly } from "../../animations";
import { maybeModalFade, maybeModalFly } from "../../animations";
import request from "../../request";
import { apiRoute } from "../../storage";
@ -77,8 +76,8 @@
}
</style>
<div class="modal-backdrop" transition:maybeFade="{{ duration: 300, easing: quintInOut }}" on:click="{ close }">
<div class="modal" class:large-settings="{ !$smallViewport }" transition:maybeFly="{{ duration: 300, easing: quintInOut, y: 10 }}" on:click|stopPropagation>
<div class="modal-backdrop" transition:maybeModalFade on:click="{ close }">
<div class="modal" class:large-settings="{ !$smallViewport }" transition:maybeModalFly on:click|stopPropagation>
<span class="input-label">Account</span>
<div class="settings-card full-width">
<AtSignIcon />

View file

@ -1,7 +1,6 @@
<script>
import { XIcon } from "svelte-feather-icons";
import { quintInOut } from "svelte/easing";
import { maybeFly } from "../../animations";
import { maybeModalFly } from "../../animations";
import { overlayStore } from "../../stores";
export let message;
@ -24,7 +23,7 @@
</style>
{#key message}
<div class="toast" transition:maybeFly="{{ duration: 300, easing: quintInOut, y: 10 }}">
<div class="toast" transition:maybeModalFly>
<span>{ message }</span>
<button class="icon-button icon-button-auto" on:click="{ () => overlayStore.close('toast') }">
<XIcon />