|
2 | 2 | import { fade, slide } from "svelte/transition"; |
3 | 3 | import Icon from "$components/Icon.svelte"; |
4 | 4 |
|
5 | | - const menu = [ |
6 | | - { |
7 | | - name: "Beranda", |
8 | | - icon: "house", |
9 | | - url: "/", |
10 | | - }, |
| 5 | + const pages = [ |
11 | 6 | { |
12 | 7 | name: "Blog", |
13 | 8 | icon: "book-half", |
|
23 | 18 | }, |
24 | 19 | ]; |
25 | 20 |
|
26 | | - let opened = $state(false); |
27 | | - const toggle = (state) => () => (opened = state); |
| 21 | + const menu = [...pages, ...social]; |
28 | 22 | </script> |
29 | 23 |
|
30 | | -<nav class="fixed top-0 left-0 w-dvw bg-neutral-900 p-4 text-white"> |
| 24 | +<nav class="fixed top-0 left-0 w-dvw animate-down bg-neutral-950 p-4 text-white drop-shadow-lg drop-shadow-black"> |
31 | 25 | <div class="mx-auto flex w-full max-w-3xl items-center justify-between"> |
32 | | - <a class="font-black hover:text-neutral-300" href="/">Hyper-Z11</a> |
33 | | - <button class="flex md:hidden" onclick={toggle(true)}><Icon icon="three-dots-vertical" class="h-5 w-5" /></button> |
34 | | - <ul class="hidden flex-row gap-4 md:flex"> |
| 26 | + <a href="/" class="hover:text-neutral-300">Z11</a> |
| 27 | + <ul class="flex flex-row gap-4"> |
35 | 28 | {#each menu as { name, icon, url } (url)} |
36 | 29 | <li> |
37 | | - <a |
38 | | - href={url} |
39 | | - title={name} |
40 | | - class="flex items-center gap-1 hover:text-neutral-300" |
41 | | - onclick={() => setTimeout(toggle(false), 100)}><Icon {icon} />{name}</a> |
42 | | - </li> |
43 | | - {/each} |
44 | | - <li><!-- Dummy, for spacing --></li> |
45 | | - {#each social as { name, icon, url } (url)} |
46 | | - <li> |
47 | | - <a href={url} title={name} class="hover:text-neutral-300" onclick={() => setTimeout(toggle(false), 100)} |
48 | | - ><Icon {icon} /></a> |
| 30 | + <a href={url} title={name} class="hover:text-neutral-300"> |
| 31 | + <Icon {icon} /> |
| 32 | + <span class="hidden md:inline">{name}</span> |
| 33 | + </a> |
49 | 34 | </li> |
50 | 35 | {/each} |
51 | 36 | </ul> |
52 | | - |
53 | | - <!--- Mobile sidebar --> |
54 | | - {#if opened} |
55 | | - <button |
56 | | - class="fixed top-0 left-0 z-98 h-dvh w-dvw backdrop-brightness-50" |
57 | | - onclick={toggle(false)} |
58 | | - aria-label="layer" |
59 | | - in:fade |
60 | | - out:fade></button> |
61 | | - |
62 | | - <ul |
63 | | - class="fixed top-0 right-0 z-100 flex h-dvh w-35 flex-col gap-4 bg-neutral-900 p-5 text-white" |
64 | | - in:slide={{ axis: "x" }} |
65 | | - out:slide={{ axis: "x" }}> |
66 | | - <li class="flex items-center justify-between"> |
67 | | - <button onclick={toggle(false)}><Icon icon="x" /></button> |
68 | | - </li> |
69 | | - {#each menu as { name, icon, url } (url)} |
70 | | - <li> |
71 | | - <a |
72 | | - href={url} |
73 | | - class="flex items-center gap-1 hover:text-neutral-300" |
74 | | - onclick={() => setTimeout(toggle(false), 100)}><Icon {icon} />{name}</a> |
75 | | - </li> |
76 | | - {/each} |
77 | | - <li class="flex items-center gap-2"> |
78 | | - {#each social as { name, icon, url } (url)} |
79 | | - <a href={url} class="hover:text-neutral-300" onclick={() => setTimeout(toggle(false), 100)}><Icon {icon} /></a> |
80 | | - {/each} |
81 | | - </li> |
82 | | - </ul> |
83 | | - {/if} |
84 | 37 | </div> |
85 | 38 | </nav> |
0 commit comments