11---
2+ import UiIcon from ' ./UiIcon.astro' ;
3+
24const currentPath = Astro .url .pathname ;
35const isPhotoArchive = currentPath === ' /photography/' ;
46
57const navigation = [
6- { name: ' 文章' , href: ' /articles/' },
7- { name: ' 摄影' , href: ' /photography/' },
8- { name: ' 标签' , href: ' /tags/' },
9- { name: ' 关于' , href: ' /about/' },
10- ];
8+ { name: ' 文章' , href: ' /articles/' , icon: ' article ' },
9+ { name: ' 摄影' , href: ' /photography/' , icon: ' camera ' },
10+ { name: ' 标签' , href: ' /tags/' , icon: ' tag ' },
11+ { name: ' 关于' , href: ' /about/' , icon: ' about ' },
12+ ] as const ;
1113---
1214
1315<header class ={ ` pt-8 sm:pt-10 ${isPhotoArchive ? ' spotlight-header--inverse' : ' ' } ` } >
1416 <div class =" shell" >
1517 <div class =" flex items-center justify-between gap-4 border-b pb-5 spotlight-header__bar" style =" border-color: var(--line);" >
16- <a href =" /" class =" text-lg font-semibold tracking-tight spotlight-header__brand text-[var(--text)]" data-astro-prefetch style =" view-transition-name: site-brand;" >Joey's Notes</a >
18+ <a href =" /" class =" spotlight-header__brand text-lg font-semibold tracking-tight text-[var(--text)]" data-astro-prefetch style =" view-transition-name: site-brand;" >
19+ <UiIcon name =" notebook" size ={ 17 } class =" spotlight-header__brand-icon" />
20+ <span >Joey's Notes</span >
21+ </a >
1722
18- <nav class =" hidden items-center gap-7 text-sm md:flex" >
23+ <nav class =" hidden items-center gap-6 text-sm md:flex" >
1924 { navigation .map ((item ) => {
2025 const active = currentPath === item .href ;
2126 return (
2227 <a href = { item .href } class = { ` relative transition spotlight-header__link ${active ? ' font-semibold text-[var(--text)]' : ' muted hover:text-[var(--text)]' } ` } data-astro-prefetch >
23- { item .name }
28+ <UiIcon name = { item .icon } size = { 14 } class = " spotlight-header__nav-icon" />
29+ <span >{ item .name } </span >
2430 { active && <span class = " absolute -bottom-1 left-0 right-0 h-px bg-[var(--accent)]" />}
2531 </a >
2632 );
@@ -32,25 +38,26 @@ const navigation = [
3238 <button
3339 type = " button"
3440 data-theme-toggle
35- class = " rounded-full border px-3 py-1.5 text-xs font-medium transition spotlight-header__button hover:bg-black/5 dark:hover:bg-white/10"
41+ class = " spotlight-header__button spotlight-header__theme-toggle rounded-full border px-3 py-1.5 text-xs font-medium transition hover:bg-black/5 dark:hover:bg-white/10"
3642 style = " border-color: var(--line); color: var(--text);"
3743 aria-label = " 切换主题"
3844 >
45+ <UiIcon name = " moon" size = { 14 } class = " spotlight-header__theme-icon spotlight-header__theme-icon--dark" />
46+ <UiIcon name = " sun" size = { 14 } class = " spotlight-header__theme-icon spotlight-header__theme-icon--light" />
3947 <span data-theme-toggle-label >深色</span >
4048 </button >
4149 )}
4250
4351 <details class =" relative md:hidden" >
44- <summary class =" cursor-pointer list-none rounded-full border px-3 py-1.5 text-xs font-medium spotlight-header__button spotlight-header__menu-toggle" style =" border-color: var(--line); color: var(--text);" aria-label =" 导航" >
45- <span class =" spotlight-header__burger" aria-hidden =" true" >
46- <span ></span >
47- <span ></span >
48- <span ></span >
49- </span >
52+ <summary class =" spotlight-header__button spotlight-header__menu-toggle cursor-pointer list-none rounded-full border px-3 py-1.5 text-xs font-medium" style =" border-color: var(--line); color: var(--text);" aria-label =" 导航" >
53+ <UiIcon name =" menu" size ={ 16 } />
5054 </summary >
51- <nav class =" absolute right-5 mt-2 min-w-36 rounded-xl border bg-[var(--surface)] p-2 text-sm shadow-sm spotlight-header__menu " style =" border-color: var(--line);" >
55+ <nav class =" spotlight-header__menu absolute right-5 mt-2 min-w-40 rounded-xl border bg-[var(--surface)] p-2 text-sm shadow-sm" style =" border-color: var(--line);" >
5256 { navigation .map ((item ) => (
53- <a href = { item .href } class = " block rounded-lg px-3 py-2 muted hover:bg-black/5 hover:text-[var(--text)] dark:hover:bg-white/5 spotlight-header__menu-link" data-astro-prefetch >{ item .name } </a >
57+ <a href = { item .href } class = " spotlight-header__menu-link muted flex items-center gap-2 rounded-lg px-3 py-2 hover:bg-black/5 hover:text-[var(--text)] dark:hover:bg-white/5" data-astro-prefetch >
58+ <UiIcon name = { item .icon } size = { 14 } />
59+ <span >{ item .name } </span >
60+ </a >
5461 ))}
5562 </nav >
5663 </details >
@@ -66,6 +73,51 @@ const navigation = [
6673 linear-gradient(180deg, #05070b 0%, #070a10 100%);
6774 }
6875
76+ .spotlight-header__brand,
77+ .spotlight-header__link,
78+ .spotlight-header__theme-toggle {
79+ display: inline-flex;
80+ align-items: center;
81+ }
82+
83+ .spotlight-header__brand {
84+ gap: 0.48rem;
85+ }
86+
87+ .spotlight-header__brand-icon {
88+ color: color-mix(in srgb, var(--accent) 72%, var(--muted));
89+ opacity: 0.82;
90+ }
91+
92+ .spotlight-header__link {
93+ gap: 0.38rem;
94+ }
95+
96+ .spotlight-header__nav-icon {
97+ opacity: 0.58;
98+ transition: opacity 0.2s ease, transform 0.2s ease;
99+ }
100+
101+ .spotlight-header__link:hover .spotlight-header__nav-icon,
102+ .spotlight-header__link.font-semibold .spotlight-header__nav-icon {
103+ opacity: 0.9;
104+ transform: translateY(-1px);
105+ }
106+
107+ .spotlight-header__theme-toggle {
108+ gap: 0.38rem;
109+ }
110+
111+ .spotlight-header__theme-icon {
112+ color: color-mix(in srgb, var(--accent) 70%, var(--muted));
113+ opacity: 0.78;
114+ }
115+
116+ :global(.dark) .spotlight-header__theme-icon--dark,
117+ :global(html:not(.dark)) .spotlight-header__theme-icon--light {
118+ display: none;
119+ }
120+
69121 .spotlight-header--inverse .spotlight-header__bar {
70122 border-color: rgba(255, 255, 255, 0.08) !important;
71123 }
@@ -76,6 +128,11 @@ const navigation = [
76128 color: rgba(248, 250, 252, 0.94) !important;
77129 }
78130
131+ .spotlight-header--inverse .spotlight-header__brand-icon,
132+ .spotlight-header--inverse .spotlight-header__theme-icon {
133+ color: rgba(245, 158, 11, 0.78);
134+ }
135+
79136 .spotlight-header--inverse .muted {
80137 color: rgba(195, 203, 214, 0.72);
81138 }
@@ -101,16 +158,7 @@ const navigation = [
101158 min-height: 2.5rem;
102159 }
103160
104- .spotlight-header__burger {
105- display: inline-grid;
106- gap: 0.22rem;
107- }
108-
109- .spotlight-header__burger span {
110- display: block;
111- width: 0.95rem;
112- height: 1.5px;
113- border-radius: 9999px;
114- background: currentColor;
161+ .spotlight-header__menu-toggle::-webkit-details-marker {
162+ display: none;
115163 }
116164</style >
0 commit comments