diff --git a/src/components/docs-sidebar.tsx b/src/components/docs-sidebar.tsx index 96a79c9..1e1458d 100644 --- a/src/components/docs-sidebar.tsx +++ b/src/components/docs-sidebar.tsx @@ -13,8 +13,8 @@ export function DocsSidebar() {
{docsConfig.sidebarNav.map((section, index) => ( -
-

+
+

{section.title}

{section.items?.length ? ( @@ -35,18 +35,18 @@ interface DocsSidebarNavItemsProps { function DocsSidebarNavItems({ items, pathname }: DocsSidebarNavItemsProps) { return items.length ? ( -
+
{items.map((item, index) => item.href ? ( {item.title} {item.label ? ( - + {item.label} ) : null} diff --git a/src/components/mobile-nav.tsx b/src/components/mobile-nav.tsx index e81ff14..d4b0ec2 100644 --- a/src/components/mobile-nav.tsx +++ b/src/components/mobile-nav.tsx @@ -3,10 +3,10 @@ import * as React from "react" import Link from "next/link" import { usePathname } from "next/navigation" -import { Menu } from "lucide-react" +import { Github, Menu } from "lucide-react" +import { docsConfig } from "@/config/docs" import { Button } from "@/components/ui/button" import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet" -import { docsConfig } from "@/config/docs" import { cn } from "@/lib/utils" export function MobileNav() { @@ -18,28 +18,51 @@ export function MobileNav() { - - - NeuroLab - -
-
- {docsConfig.mainNav?.map( + +
+ setOpen(false)} + className="block" + > +
+ NeuroLab Docs +
+
+ Platform documentation +
+ +
+ +
+
+ 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{' '} + + + +
+