import { NavbarItem } from '../components/navbar'; import RemoveRoundedIcon from '@material-ui/icons/RemoveRounded'; import KeyboardArrowRightRoundedIcon from '@material-ui/icons/KeyboardArrowRightRounded'; import KeyboardArrowDownRoundedIcon from '@material-ui/icons/KeyboardArrowDownRounded'; interface chapter { name: string; sectionLink?: string; children?: Array; } class Chapter { constructor(public chapters: Array, public level: number) {} render() { console.log(this) return
{ this.chapters?.map(chapter => { return } chapterIndent={this.level} title={chapter.name}> { new Chapter(chapter.children, this.level + 1).render() } }) }
} } export default function Chapters(props: { chapters: Array; }) { return new Chapter(props.chapters, 0).render(); }