import {useState} from 'react'; import Link from 'next/link'; export type NavEntryInfo = { label: string link: string children?: NavEntryInfo[] }; export function NavEntry
({ entry: {label, link, children}, dir, here, children: childrenJSX, }: {entry: NavEntryInfo, dir: string, here: string, children?: Body}) { const href = dir+link; const isHere = href.replace(/\/$/, '')===here; // remove trailing slash const isRHere = isHere || here.startsWith(href); // here or is children const [toggle, setToggle] = useState(isRHere); const entryCls = 'nav-entry'+(isHere ? ' nav-here' : ''); return children?.length ?