+
+ setOpen(false)}
+ className="flex items-center gap-2 rounded-lg px-3 py-2 text-sm text-zinc-600 transition-colors hover:bg-zinc-100 hover:text-zinc-950 dark:text-zinc-300 dark:hover:bg-zinc-900 dark:hover:text-zinc-50"
+ >
+
+ View code
+
+ {docsConfig.mainNav.map(
(item) =>
item.href && (
{item.title}
@@ -47,32 +70,35 @@ export function MobileNav() {
)
)}
-
- {docsConfig.sidebarNav.map((item, index) => (
-
-
{item.title}
- {item?.items?.length &&
- item.items.map((item) => (
-
- {!item.disabled &&
- (item.href ? (
-
- {item.title}
-
- ) : (
- item.title
- ))}
-
- ))}
-
- ))}
+
+
+
+ Documentation
+
+
+ {docsConfig.sidebarNav.map((section) => (
+
+
+ {section.title}
+
+
+ {section.items.map((item) =>
+ item.href ? (
+
+ {item.title}
+
+ ) : null
+ )}
+
+
+ ))}
+
@@ -82,6 +108,7 @@ export function MobileNav() {
interface MobileLinkProps {
href: string
+ pathname: string
onOpenChange?: (open: boolean) => void
children: React.ReactNode
className?: string
@@ -89,24 +116,36 @@ interface MobileLinkProps {
function MobileLink({
href,
+ pathname,
onOpenChange,
- className,
children,
- ...props
+ className,
}: MobileLinkProps) {
- const pathname = usePathname()
+ const allHrefs = [
+ ...docsConfig.mainNav.map((n) => n.href),
+ ...docsConfig.sidebarNav.flatMap((s) => s.items.map((i) => i.href)),
+ ].filter(Boolean) as string[]
+
+ const active =
+ pathname === href ||
+ (href !== "/" &&
+ pathname.startsWith(href) &&
+ !allHrefs.some(
+ (other) =>
+ other !== href && pathname.startsWith(other) && other.length > href.length
+ ))
+
return (
{
- onOpenChange?.(false)
- }}
+ onClick={() => onOpenChange?.(false)}
className={cn(
- "text-foreground/70 transition-colors hover:text-foreground",
- pathname === href && "text-foreground",
+ "block rounded-lg px-3 py-2 text-sm transition-colors",
+ active
+ ? "bg-zinc-100 font-medium text-zinc-950 dark:bg-zinc-900 dark:text-zinc-50"
+ : "hover:bg-zinc-100 hover:text-zinc-950 dark:hover:bg-zinc-900 dark:hover:text-zinc-50",
className
)}
- {...props}
>
{children}
diff --git a/src/components/search.tsx b/src/components/search.tsx
index 3f44ac6..39058dc 100644
--- a/src/components/search.tsx
+++ b/src/components/search.tsx
@@ -1,24 +1,16 @@
'use client'
+import Link from 'next/link'
import { Search as SearchIcon } from 'lucide-react'
-import { Button } from '@/components/ui/button'
export function Search() {
return (
-
+
+
Search documentation
+
)
}
diff --git a/src/components/site-header.tsx b/src/components/site-header.tsx
index b69ecc5..f0b7864 100644
--- a/src/components/site-header.tsx
+++ b/src/components/site-header.tsx
@@ -2,58 +2,80 @@
import Link from 'next/link'
import { usePathname } from 'next/navigation'
-import { cn } from '@/lib/utils'
+import { Github, Star } from 'lucide-react'
import { docsConfig } from '@/config/docs'
import { MobileNav } from '@/components/mobile-nav'
-import { ThemeToggle } from '@/components/theme-toggle'
import { Search } from '@/components/search'
-import { LucideGithub } from 'lucide-react'
+import { ThemeToggle } from '@/components/theme-toggle'
+import { cn } from '@/lib/utils'
export function SiteHeader() {
const pathname = usePathname()
return (
-
-
+
+
-
-
-
- NeuroLab
+
+
+
+
+ NeuroLab Docs
-
-
+
+
+
+ )
+ })}
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+ 221K{' '}
+
+
+
+
+