import {useState} from 'react'; import Link from 'next/link'; import NavHeader from './NavHeader'; import type {HeadingInfo} from '@sup39/rehype-mdx-export-headings'; import config from '#config'; export type NavEntryInfo = { name: string link: string children?: NavEntryInfo[]|null }; export function NavEntry
({ entry: {name, link, children}, dir, here, children: childrenJSX, }: {entry: NavEntryInfo, dir: string, here: string, children?: Body}) { const [toggle, setToggle] = useState(false); const href = dir+link; const isHere = href.replace(/\/$/, '')===here; // remove trailing slash const entryCls = 'nav-entry'+(isHere ? ' nav-here' : ''); return children?.length ?