Skip to content

Commit 1bb20ff

Browse files
committed
refactor: use svelte/transition fly instead of CSS keyframes
1 parent c953d7f commit 1bb20ff

1 file changed

Lines changed: 4 additions & 18 deletions

File tree

client/src/components/input/SlashCommandMenu.svelte

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<script lang="ts">
2+
import { fly } from 'svelte/transition';
23
import { slashCommandState } from '../../lib/state/slash-commands.svelte';
34
import type { SlashCommand } from '../../lib/commands/registry';
45
6+
const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
7+
58
interface Props {
69
onselect: (cmd: SlashCommand) => void;
710
}
@@ -26,6 +29,7 @@
2629
id="slash-command-menu"
2730
role="listbox"
2831
aria-label="Slash commands"
32+
transition:fly={{ y: 4, duration: reducedMotion ? 0 : 120 }}
2933
>
3034
{#each slashCommandState.suggestions as cmd, i}
3135
<!-- svelte-ignore a11y_click_events_have_key_events -->
@@ -66,24 +70,6 @@
6670
overflow-y: auto;
6771
z-index: 100;
6872
margin-bottom: 4px;
69-
animation: slide-up 120ms ease-out;
70-
}
71-
72-
@keyframes slide-up {
73-
from {
74-
opacity: 0;
75-
transform: translateY(4px);
76-
}
77-
to {
78-
opacity: 1;
79-
transform: translateY(0);
80-
}
81-
}
82-
83-
@media (prefers-reduced-motion: reduce) {
84-
.slash-menu {
85-
animation: none;
86-
}
8773
}
8874
8975
.slash-item {

0 commit comments

Comments
 (0)