import Link from "next/link.js"; export interface TocSection { id: string; title: string; level: string; children?: any; } interface Props { tableOfContents: TocSection[]; currentSection: string; } export const TableOfContents: React.FC = ({ tableOfContents, currentSection, }) => { function isActiveSection(section) { if (section.id === currentSection) { return true; } if (!section.children) { return false; } return section.children.findIndex(isActiveSection) > -1; } return ( ); };