"use client" import TocObserver from "./TocObserver" import { ScrollArea } from "@/components/ui/scroll-area" import { ListIcon } from "lucide-react" import Sponsor from "./Sponsor" import { useActiveSection } from "@/hooks" import { TocItem } from "@/lib/toc" import { cn } from "@/lib/utils" export default function Toc({ tocs }: { tocs: TocItem[] }) { const { activeId, setActiveId } = useActiveSection(tocs) const hasTocs = Boolean(tocs?.length) const wrapperClassName = cn( hasTocs ? "toc" : "", "flex-3 sticky top-4 hidden h-[calc(100vh-8rem)] min-w-[240px] self-start lg:flex lg:p-8" ) return (
{hasTocs && ( <>

On this page

)} {!hasTocs && (
)}
) }