@@ -16,17 +16,26 @@ import { ThemeToggle } from '@/components/ThemeToggle'
1616import { cn } from '@/lib/utils'
1717import GitHubStarCount from '../GitHubStarCount'
1818import { GitHubIcon } from '../icons/GitHubIcon'
19+ import { usePathname } from 'next/navigation'
1920
2021function TopLevelNavItem ( {
2122 className,
23+ parentHref,
2224 ...props
23- } : ComponentPropsWithoutRef < typeof Link > ) {
25+ } : ComponentPropsWithoutRef < typeof Link > & { parentHref ?: string } ) {
26+ const pathname = usePathname ( )
27+
28+ const isActive = parentHref
29+ ? pathname . startsWith ( parentHref )
30+ : pathname === props . href
31+
2432 return (
2533 < li >
2634 < Link
2735 { ...props }
2836 className = { cn (
2937 'text-sm font-semibold leading-5 text-zinc-600 transition hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white' ,
38+ isActive && 'text-zinc-900 dark:text-white' ,
3039 className ,
3140 ) }
3241 />
@@ -73,25 +82,26 @@ export const Header = forwardRef<
7382 < Link href = "/" aria-label = "Home" className = "hidden lg:block" >
7483 < Logo className = "h-6" />
7584 </ Link >
76- < div className = "hidden lg:block" >
77- < Search />
78- </ div >
85+
7986 < div className = "flex items-center gap-5 lg:hidden" >
8087 < MobileNavigation />
8188 < Link href = "/" aria-label = "Home" >
8289 < Logo className = "h-6" />
8390 </ Link >
8491 </ div >
8592 < div className = "flex items-center gap-5" >
86- < nav className = "hidden md :block" >
93+ < nav className = "hidden lg :block" >
8794 < ul role = "list" className = "flex items-center gap-8" >
8895 < TopLevelNavItem
89- href = { 'https://nitric.io' }
90- target = "_blank"
91- rel = "noreferrer noopener"
96+ parentHref = "/get-started/foundations"
97+ href = "/get-started/foundations/why-nitric"
9298 >
93- Nitric.io
99+ Foundations
94100 </ TopLevelNavItem >
101+ < TopLevelNavItem href = "/guides" > Guides</ TopLevelNavItem >
102+ < li >
103+ < Search />
104+ </ li >
95105
96106 < TopLevelNavItem
97107 className = "group flex items-center"
0 commit comments