Skip to content

Commit d44fcd0

Browse files
committed
animate mobile menu open and close
1 parent 0fef268 commit d44fcd0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/lib/components/Header.svelte

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<script lang="ts">
22
import { Telescope, Activity, BookOpenText } from "@lucide/svelte";
33
import { base } from "$app/paths";
4+
import { slide } from "svelte/transition";
5+
import { fade } from "svelte/transition";
46
let isOpen = $state(false);
57
68
function toggleMenu() {
@@ -78,7 +80,7 @@
7880
class="text-sm/6 font-semibold text-secondary relative after:absolute after:bottom-0 after:left-0 after:h-0.5 after:w-0 after:bg-secondary after:transition-all after:duration-200 hover:after:w-full"
7981
>Validators</a
8082
>
81-
<div class="h-4 w-px bg-secondary/20 -mx-2"></div>
83+
<div class="h-6 w-px bg-secondary/20 -mx-2"></div>
8284
<a
8385
href="https://explorer.orcfax.io"
8486
target="_blank"
@@ -102,9 +104,13 @@
102104
<!-- Mobile menu, show/hide based on menu open state. -->
103105
{#if isOpen}
104106
<div class="xl:hidden" role="dialog" aria-modal="true">
105-
<div class="fixed inset-0 z-50"></div>
107+
<div
108+
class="fixed inset-0 z-50 bg-black/20 backdrop-blur-sm"
109+
transition:fade={{ duration: 400 }}
110+
></div>
106111
<div
107112
class="fixed inset-y-0 right-0 z-50 w-full overflow-y-auto bg-white px-6 py-6 sm:max-w-sm sm:ring-1 sm:ring-gray-900/10"
113+
transition:slide={{ duration: 400, axis: "x" }}
108114
>
109115
<div class="flex items-center justify-between">
110116
<div class="flex xl:flex-1">

0 commit comments

Comments
 (0)