11---
2+ interface Props {
3+ pathname? : string ;
4+ }
5+
6+ const { pathname = " /" } = Astro .props ;
7+ const isHomePage = pathname === " /" ;
8+ const sectionPrefix = isHomePage ? " " : " /" ;
9+
210const navLinks = [
3- { label: " Features" , href: " #features" },
4- { label: " Installation" , href: " #installation" },
5- { label: " FAQ" , href: " #faq" },
11+ { label: " Features" , href: ` ${sectionPrefix }#features ` , sectionId: " features" },
12+ { label: " Installation" , href: ` ${sectionPrefix }#installation ` , sectionId: " installation" },
13+ { label: " Pricing" , href: " /pricing" },
14+ { label: " FAQ" , href: ` ${sectionPrefix }#faq ` , sectionId: " faq" },
615 { label: " GitHub" , href: " https://github.com/mxvsh/livedot" , external: true },
716];
817---
918
1019<header class =" fixed inset-x-0 top-0 z-50 border-b border-white/5 bg-surface/80 backdrop-blur-md" >
1120 <nav class =" mx-auto flex h-20 max-w-7xl items-center justify-between px-6" >
12- <a href =" # " class =" flex items-center gap-3 text-lg font-bold text-primary md:text-xl" >
21+ <a href =" / " class =" flex items-center gap-3 text-lg font-bold text-primary md:text-xl" >
1322 <img src =" /logo.svg" alt =" Livedot logo" class =" h-8 w-8 rounded-md" />
1423 <span class =" brand-wordmark" >livedot</span >
1524 </a >
@@ -18,12 +27,14 @@ const navLinks = [
1827 { navLinks .map ((link ) => (
1928 <a
2029 href = { link .href }
21- data-section-link = { link .external ? undefined : link .href .slice (1 )}
30+ data-section-link = { isHomePage && link .sectionId ? link .sectionId : undefined }
31+ aria-current = { pathname === link .href ? " page" : undefined }
2232 class :list = { [
2333 " border-b-2 pb-1 transition-colors" ,
2434 link .external
2535 ? " border-transparent text-on-surface-variant hover:text-white"
2636 : " border-transparent text-on-surface-variant hover:text-white" ,
37+ pathname === link .href ? " border-primary text-primary" : " " ,
2738 ]}
2839 >
2940 { link .label }
0 commit comments