feat(TypographyMenu): add appearance/disappearance animation
This commit is contained in:
@@ -1,15 +1,37 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import SetupFontMenu from '$features/SetupFont/ui/SetupFontMenu.svelte';
|
import { SetupFontMenu } from '$features/SetupFont';
|
||||||
import {
|
import {
|
||||||
Content as ItemContent,
|
Content as ItemContent,
|
||||||
Root as ItemRoot,
|
Root as ItemRoot,
|
||||||
} from '$shared/shadcn/ui/item';
|
} from '$shared/shadcn/ui/item';
|
||||||
|
|
||||||
|
import { displayedFontsStore } from '$features/DisplayFont';
|
||||||
|
import { cubicOut } from 'svelte/easing';
|
||||||
|
import { crossfade } from 'svelte/transition';
|
||||||
|
|
||||||
|
const [send, receive] = crossfade({
|
||||||
|
duration: 400,
|
||||||
|
easing: cubicOut,
|
||||||
|
fallback(node, params) {
|
||||||
|
// If it can't find a pair, it falls back to a simple fade/slide
|
||||||
|
return {
|
||||||
|
duration: 400,
|
||||||
|
css: t => `opacity: ${t}; transform: translateY(${(1 - t) * 10}px);`,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="w-full p-2 backdrop-blur-2xl">
|
{#if displayedFontsStore.hasAnyFonts}
|
||||||
<ItemRoot variant="outline" class="w-full p-2.5">
|
<div
|
||||||
<ItemContent class="flex flex-row justify-center items-center">
|
class="w-auto fixed bottom-5 left-1/2 translate-x-[-50%] max-w-max z-10"
|
||||||
<SetupFontMenu />
|
in:receive={{ key: 'panel' }}
|
||||||
</ItemContent>
|
out:send={{ key: 'panel' }}
|
||||||
</ItemRoot>
|
>
|
||||||
</div>
|
<ItemRoot variant="outline" class="w-auto max-w-max p-2.5 rounded-2xl backdrop-blur-lg">
|
||||||
|
<ItemContent class="flex flex-row justify-center items-center max-w-max">
|
||||||
|
<SetupFontMenu />
|
||||||
|
</ItemContent>
|
||||||
|
</ItemRoot>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user