2023-08-05 17:32:29 -04:00
|
|
|
export const layout = "./base.tsx";
|
|
|
|
|
2023-12-03 10:57:42 -05:00
|
|
|
export default function({ children, toc }) {
|
2023-08-05 17:32:29 -04:00
|
|
|
return (
|
2023-12-03 10:57:42 -05:00
|
|
|
<>
|
|
|
|
{ toc.length > 0 &&
|
|
|
|
<nav class="toc">
|
|
|
|
<h2>Table of Contents</h2>
|
|
|
|
<ol>
|
|
|
|
{toc.map(item => (
|
|
|
|
<li>
|
|
|
|
<a href={`#${item.slug}`}>{item.text}</a>
|
|
|
|
{item.children.length > 0 &&
|
|
|
|
<ul>
|
|
|
|
{item.children.map(child => (
|
|
|
|
<li>
|
|
|
|
<a href={`#${child.slug}`}>{child.text}</a>
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
}
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ol>
|
|
|
|
</nav>
|
|
|
|
}
|
|
|
|
<article>
|
|
|
|
{ children }
|
|
|
|
</article>
|
|
|
|
</>
|
2023-08-05 17:32:29 -04:00
|
|
|
);
|
|
|
|
}
|