-
Notifications
You must be signed in to change notification settings - Fork 69
/
Drawer.astro
64 lines (61 loc) · 1.51 KB
/
Drawer.astro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
import Link from "./Link.astro";
import { Icon } from "astro-icon/components";
const links: { text: string; href: string }[] = [
{
text: "Quick start",
href: "/start",
},
{
text: "Concepts",
href: "/concepts",
},
{
text: "About",
href: "/about",
},
];
---
<div
x-cloak
x-show="drawer"
x-transition:enter="transition ease-in-out duration-200"
x-transition:enter-start="-translate-x-full"
x-transition:enter-end="translate-x-0"
x-transition:leave="transition ease-in-out duration-300 transform"
x-transition:leave-start="translate-x-0"
x-transition:leave-end="-translate-x-full"
class="fixed z-40 flex h-full flex-col overflow-y-auto border-r border-t border-light-gray bg-white p-4 shadow-xl dark:border-dark-gray dark:bg-dark"
tabindex="-1"
id="nav-drawer"
aria-labelledby="nav-drawer"
>
<div class="flex justify-end">
<button
@click="drawer = false"
data-drawer-hide="nav-drawer"
aria-controls="nav-drawer"
>
<Icon
name="heroicons:x-mark"
class="h-4 w-4 dark:text-light-gray dark:hover:text-primary"
/>
<span class="sr-only">Close menu</span>
</button>
</div>
<ul class="space-y-1 pr-20">
{
links.map(({ text, href }) => (
<li>
<Link
{href}
class="text-lg font-light tracking-tight hover:text-primary md:text-base lg:text-lg"
@click="drawer = false"
>
{text}
</Link>
</li>
))
}
</ul>
</div>