swarm-ui: menus, popovers, toasts and dialogs fade in, with one motion guard
Dialogs, toasts, popovers, dropdowns and the filter popover appeared with no transition, and the header menu had a keyframe of its own. theme.css holds --enter and --fade, off under reduced motion and the motion setting's reduce, and each floating box uses them.
This commit is contained in:
parent
fdeb95a61b
commit
9fdde2ec63
1 changed files with 135 additions and 25 deletions
|
|
@ -109,3 +109,46 @@
|
|||
var(--purple-dim)
|
||||
);
|
||||
}
|
||||
|
||||
/* Entrance motion. A floating box (a menu, a popover, a toast, a dialog) fades
|
||||
in and drops a few pixels into place as it opens, and a dialog's backdrop
|
||||
fades in. `--enter` and `--fade` are whole `animation` values, so a rule
|
||||
writes `animation: var(--enter)` and the motion guard lives here once: off
|
||||
under `prefers-reduced-motion` and the motion setting's "reduce", back on
|
||||
for "allow". */
|
||||
:root {
|
||||
--enter: ui-enter 0.14s ease-out;
|
||||
--fade: ui-fade 0.14s ease-out;
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
:root {
|
||||
--enter: none;
|
||||
--fade: none;
|
||||
}
|
||||
}
|
||||
:root[data-motion="reduce"] {
|
||||
--enter: none;
|
||||
--fade: none;
|
||||
}
|
||||
:root[data-motion="allow"] {
|
||||
--enter: ui-enter 0.14s ease-out;
|
||||
--fade: ui-fade 0.14s ease-out;
|
||||
}
|
||||
@keyframes ui-enter {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-4px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
@keyframes ui-fade {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue