File tree 4 files changed +82
-50
lines changed
4 files changed +82
-50
lines changed Original file line number Diff line number Diff line change 18
18
"@sveltejs/vite-plugin-svelte" : " ^3.0.2" ,
19
19
"@tailwindcss/typography" : " ^0.5.12" ,
20
20
"@types/eslint" : " ^8.56.7" ,
21
- "@types/node" : " ^20.12.3 " ,
21
+ "@types/node" : " ^20.12.5 " ,
22
22
"@typescript-eslint/eslint-plugin" : " ^7.5.0" ,
23
23
"@typescript-eslint/parser" : " ^7.5.0" ,
24
24
"autoprefixer" : " ^10.4.19" ,
32
32
"svelte-check" : " ^3.6.9" ,
33
33
"tailwindcss" : " ^3.4.3" ,
34
34
"tslib" : " ^2.6.2" ,
35
- "typescript" : " ^5.4.3 " ,
36
- "vite" : " ^5.2.7 "
35
+ "typescript" : " ^5.4.4 " ,
36
+ "vite" : " ^5.2.8 "
37
37
},
38
38
"type" : " module" ,
39
39
"dependencies" : {
43
43
"cmdk-sv" : " ^0.0.17" ,
44
44
"dompurify" : " ^3.0.11" ,
45
45
"ky" : " ^1.2.3" ,
46
- "lucide-svelte" : " ^0.364 .0" ,
46
+ "lucide-svelte" : " ^0.365 .0" ,
47
47
"mode-watcher" : " ^0.3.0" ,
48
48
"moment" : " ^2.30.1" ,
49
49
"svelte-sonner" : " ^0.3.21" ,
Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
2
import { page } from ' $app/stores' ;
3
3
import { Button } from ' $lib/components/ui/button' ;
4
+ import { MenuIcon , XIcon } from ' lucide-svelte' ;
4
5
import ThemeToggler from ' ./ThemeToggler.svelte' ;
5
6
interface link {
6
7
label: string ;
28
29
}
29
30
links = links ;
30
31
}
31
- // TODO: responsive navbar
32
+ let showMenu = false ;
32
33
</script >
33
34
34
35
<nav class =" block w-full sm:mt-3 mb-6" >
35
- <div
36
- class = " flex justify-around items-center w-full sm:max-w-[500px] mx-auto px-6 py-4 sm:rounded-2xl shadow-md sm:border bg-background "
37
- >
38
- < div class = " flex items-center " >
36
+ <div class = " flex flex-col items-center w-full sm:max-w-[500px] sm:mx-auto bg-background " >
37
+ < div
38
+ class = " flex justify-between sm:justify-around w-full px-2 sm:px-6 py-2 sm:py-4 sm:rounded-2xl shadow-md sm:border "
39
+ >
39
40
<img src =" /icon-96.png" alt =" icon" class =" w-10" />
40
- <!-- <h2 class="font-bold text-xl">Fusion</h2> -->
41
+ <div class =" hidden sm:block" >
42
+ {#each links as l }
43
+ <Button
44
+ variant =" ghost"
45
+ href ={l .url }
46
+ class ={l .highlight ? ' bg-accent text-accent-foreground' : ' ' }
47
+ >
48
+ {l .label }
49
+ </Button >
50
+ {/each }
51
+ </div >
52
+ <ThemeToggler className =" hidden sm:flex" />
53
+ <Button
54
+ variant =" ghost"
55
+ size =" icon"
56
+ on:click ={() => (showMenu = ! showMenu )}
57
+ class =" flex sm:hidden"
58
+ >
59
+ {#if showMenu }
60
+ <XIcon size =" 15" />
61
+ {:else }
62
+ <MenuIcon size =" 15" />
63
+ {/if }
64
+ </Button >
41
65
</div >
42
- <div >
43
- {#each links as l }
44
- <Button
45
- variant =" ghost"
46
- href ={l .url }
47
- class ={l .highlight ? ' bg-accent text-accent-foreground' : ' ' }
48
- >
49
- {l .label }
50
- </Button >
51
- {/each }
66
+
67
+ <div class =" relative w-full" >
68
+ {#if showMenu }
69
+ <div class =" flex flex-col w-full absolute top-0 bg-background shadow-md" >
70
+ {#each links as l }
71
+ <Button
72
+ variant =" ghost"
73
+ href ={l .url }
74
+ on:click ={() => (showMenu = false )}
75
+ class ="w-full {l .highlight ? ' bg-accent text-accent-foreground' : ' ' }"
76
+ >
77
+ {l .label }
78
+ </Button >
79
+ {/each }
80
+ <ThemeToggler className =" w-full" />
81
+ </div >
82
+ {/if }
52
83
</div >
53
- <ThemeToggler />
54
84
</div >
55
85
</nav >
Original file line number Diff line number Diff line change 5
5
import Moon from ' lucide-svelte/icons/moon' ;
6
6
7
7
import { setMode , resetMode } from ' mode-watcher' ;
8
+
9
+ export let className = ' ' ;
8
10
</script >
9
11
10
12
<DropdownMenu .Root >
11
13
<DropdownMenu .Trigger asChild let:builder >
12
- <Button builders ={[builder ]} variant =" ghost" size =" icon" >
14
+ <Button builders ={[builder ]} variant ="ghost" size ="icon" class ={ className } >
13
15
<Sun
14
16
class =" h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"
15
17
/>
You can’t perform that action at this time.
0 commit comments