Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
feat: add animation for sidebar & move logo up a bit
Browse files
src/lib/components/MobileNav.svelte
CHANGED
@@ -5,6 +5,7 @@
|
|
5 |
import { page } from "$app/state";
|
6 |
import IconNew from "$lib/components/icons/IconNew.svelte";
|
7 |
import { createEventDispatcher } from "svelte";
|
|
|
8 |
import CarbonClose from "~icons/carbon/close";
|
9 |
import CarbonTextAlignJustify from "~icons/carbon/text-align-justify";
|
10 |
|
@@ -58,19 +59,22 @@
|
|
58 |
class="-mr-3 flex size-12 shrink-0 items-center justify-center text-lg"><IconNew /></a
|
59 |
>
|
60 |
</nav>
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
:
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
</
|
|
|
|
|
|
|
|
5 |
import { page } from "$app/state";
|
6 |
import IconNew from "$lib/components/icons/IconNew.svelte";
|
7 |
import { createEventDispatcher } from "svelte";
|
8 |
+
import { fly } from "svelte/transition";
|
9 |
import CarbonClose from "~icons/carbon/close";
|
10 |
import CarbonTextAlignJustify from "~icons/carbon/text-align-justify";
|
11 |
|
|
|
59 |
class="-mr-3 flex size-12 shrink-0 items-center justify-center text-lg"><IconNew /></a
|
60 |
>
|
61 |
</nav>
|
62 |
+
|
63 |
+
{#if isOpen}
|
64 |
+
<nav
|
65 |
+
class="fixed inset-0 z-30 grid max-h-screen grid-cols-1 grid-rows-[auto,auto,1fr,auto] bg-white pt-4 dark:bg-gray-900"
|
66 |
+
in:fly={{ x: -window.innerWidth, duration: 250 }}
|
67 |
+
out:fly={{ x: -window.innerWidth, duration: 250 }}
|
68 |
+
>
|
69 |
+
<div class="absolute inset-0 z-10 flex h-12 items-center px-4">
|
70 |
+
<button
|
71 |
+
type="button"
|
72 |
+
class="-mr-3 ml-auto flex size-12 items-center justify-center text-lg"
|
73 |
+
onclick={() => dispatch("toggle", false)}
|
74 |
+
aria-label="Close menu"
|
75 |
+
bind:this={closeEl}><CarbonClose /></button
|
76 |
+
>
|
77 |
+
</div>
|
78 |
+
{@render children?.()}
|
79 |
+
</nav>
|
80 |
+
{/if}
|