11---
2- import ScrollHeader from " .. /components/solid/ScrollHeader" ;
3- import ThemeToggle from " .. /components/solid/ThemeToggle" ;
2+ import ScrollHeader from " @ /components/solid/ScrollHeader" ;
3+ import ThemeToggle from " @ /components/solid/ThemeToggle" ;
44
55// Get current path to highlight active navigation item
66const currentPath = Astro .url .pathname ;
@@ -11,7 +11,7 @@ const isProjectsPage = currentPath.startsWith("/projects");
1111
1212// Helper function to determine tab classes
1313const getTabClass = (isActive : boolean ) => {
14- return isActive ? " tab tab-active" : " tab" ;
14+ return isActive ? " tab tab-active" : " tab" ;
1515};
1616---
1717
@@ -38,10 +38,35 @@ const getTabClass = (isActive: boolean) => {
3838 tabindex =" 0"
3939 class =" menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow bg-base-100 rounded-box w-52"
4040 >
41- <li ><a href =" /" class ={ isHomePage ? " font-bold text-primary" : " " } >首页</a ></li >
42- <li ><a href =" /blog" class ={ isBlogPage ? " font-bold text-primary" : " " } >博客</a ></li >
43- <li ><a href =" /about" class ={ isAboutPage ? " font-bold text-primary" : " " } >关于我</a ></li >
44- <li ><a href =" /projects" class ={ isProjectsPage ? " font-bold text-primary" : " " } >项目</a ></li >
41+ <li >
42+ <a
43+ href =" /"
44+ class ={ isHomePage ? " font-bold text-primary" : " " }
45+ >首页</a
46+ >
47+ </li >
48+ <li >
49+ <a
50+ href =" /blog"
51+ class ={ isBlogPage ? " font-bold text-primary" : " " }
52+ >博客</a
53+ >
54+ </li >
55+ <li >
56+ <a
57+ href =" /about"
58+ class ={ isAboutPage ? " font-bold text-primary" : " " }
59+ >关于我</a
60+ >
61+ </li >
62+ <li >
63+ <a
64+ href =" /projects"
65+ class ={ isProjectsPage
66+ ? " font-bold text-primary"
67+ : " " } >项目</a
68+ >
69+ </li >
4570 </ul >
4671 </div >
4772 <a href =" /" class =" btn btn-ghost text-xl" >
@@ -51,9 +76,17 @@ const getTabClass = (isActive: boolean) => {
5176 <div class =" navbar-center hidden lg:flex" >
5277 <div role =" tablist" class =" tabs tabs-bordered" >
5378 <a href =" /" role =" tab" class ={ getTabClass (isHomePage )} >首页</a >
54- <a href =" /blog" role =" tab" class ={ getTabClass (isBlogPage )} >博客</a >
55- <a href =" /about" role =" tab" class ={ getTabClass (isAboutPage )} >关于我</a >
56- <a href =" /projects" role =" tab" class ={ getTabClass (isProjectsPage )} >项目</a >
79+ <a href =" /blog" role =" tab" class ={ getTabClass (isBlogPage )}
80+ >博客</a
81+ >
82+ <a href =" /about" role =" tab" class ={ getTabClass (isAboutPage )}
83+ >关于我</a
84+ >
85+ <a
86+ href =" /projects"
87+ role =" tab"
88+ class ={ getTabClass (isProjectsPage )} >项目</a
89+ >
5790 </div >
5891 </div >
5992 <div class =" navbar-end" >
0 commit comments