"use client"; import { Button } from "@openstatus/ui/components/ui/button"; import { Drawer, DrawerContent, DrawerTitle, DrawerTrigger, } from "@openstatus/ui/components/ui/drawer"; import { Menu } from "lucide-react"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useEffect, useState } from "react"; import { cn } from "../lib/utils"; import { type DocsNavGroup, type DocsNavItem, docsNav, isExternalItem, isGroupItem, } from "./docs.config"; // A group header and its direct pages share one indent level; descending into a // nested chapter steps in by one. Top sections and their pages stay flat at 0. const rowIndent = (depth: number) => ({ paddingLeft: `${0.5 + depth * 0.75}rem`, }); function groupContainsActive(group: DocsNavGroup, pathname: string): boolean { return group.items.some((item) => { if (isExternalItem(item)) return false; if (isGroupItem(item)) return groupContainsActive(item, pathname); return pathname === `/docs/${item.slug}`; }); } function CollapsibleList({ open, children, className, }: { open: boolean; children: React.ReactNode; className?: string; }) { return (
{children}
); } // A collapsible group — used identically for top-level sections and nested // chapters; only the indent depth differs. function NavGroup({ group, pathname, onNavigate, depth, }: { group: DocsNavGroup; pathname: string; onNavigate?: () => void; depth: number; }) { const containsActive = groupContainsActive(group, pathname); const [open, setOpen] = useState(!group.collapsed || containsActive); useEffect(() => { if (containsActive) setOpen(true); }, [containsActive]); return (
); } function NavItems({ items, pathname, onNavigate, depth, }: { items: DocsNavItem[]; pathname: string; onNavigate?: () => void; depth: number; }) { return ( ); } function NavTree({ pathname, onNavigate, }: { pathname: string; onNavigate?: () => void; }) { return ( ); } export function DocsSidebar({ className }: { className?: string }) { const pathname = usePathname(); return ( ); } export function DocsMobileNav({ className }: { className?: string }) { const pathname = usePathname(); const [open, setOpen] = useState(false); return (
Documentation
setOpen(false)} />
); }