11---
2+ import { Icon } from ' astro-icon/components' ;
23const navLinks = [
34 { href: ' /projects' , label: ' Projects' },
45 { href: ' /webring' , label: ' Webring' },
@@ -11,21 +12,40 @@ const path = Astro.url.pathname;
1112 <a href =" /projects" class =" text-lg font-bold tracking-tight" >
1213 Carleton Computer Science <span class =" text-accent" >Showcase</span >
1314 </a >
14- <nav class =" flex gap-5 text-sm" >
15- {
16- navLinks .map (({ href , label }) => (
17- <a
18- href = { href }
19- aria-current = { path .startsWith (href ) ? ' page' : undefined }
20- class :list = { [
21- ' hover:text-accent transition-colors' ,
22- path .startsWith (href ) ? ' text-accent' : ' text-muted' ,
23- ]}
24- >
25- { label }
26- </a >
27- ))
28- }
29- </nav >
15+ <div class =" grouped flex items-center gap-5" >
16+ <nav class =" flex gap-5 text-sm" >
17+ {
18+ navLinks .map (({ href , label }) => (
19+ <a
20+ href = { href }
21+ aria-current = { path .startsWith (href ) ? ' page' : undefined }
22+ class :list = { [
23+ ' hover:text-accent transition-colors' ,
24+ path .startsWith (href ) ? ' text-accent' : ' text-muted' ,
25+ ]}
26+ >
27+ { label }
28+ </a >
29+ ))
30+ }
31+ </nav >
32+ <button
33+ id =" theme-toggle"
34+ type =" button"
35+ aria-label =" Toggle dark mode"
36+ class =" text-muted hover:text-accent inline-flex items-center justify-center transition-colors"
37+ >
38+ <!-- Import Lucide Icons -->
39+ <Icon name =" lucide:sun" class =" hidden size-5 dark:inline" />
40+ <Icon name =" lucide:moon" class =" size-5 dark:hidden" />
41+ </button >
42+ </div >
3043 </div >
3144</header >
45+
46+ <script is:inline >
47+ document.getElementById('theme-toggle')?.addEventListener('click', () => {
48+ const isDark = document.documentElement.classList.toggle('dark');
49+ localStorage.setItem('theme', isDark ? 'dark' : 'light');
50+ });
51+ </script >
0 commit comments