initial commit
This commit is contained in:
commit
3c2fb32b3e
73 changed files with 22349 additions and 0 deletions
33
src/components/navigation/sidebars/toc/Heading.tsx
Normal file
33
src/components/navigation/sidebars/toc/Heading.tsx
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { For, type Component } from "solid-js";
|
||||
|
||||
import type { ConfigTOC } from "../types";
|
||||
|
||||
export const Heading: Component<{
|
||||
heading: ConfigTOC;
|
||||
index: number;
|
||||
}> = props => {
|
||||
const { heading, index } = props;
|
||||
|
||||
return (
|
||||
<li class={`toc_heading toc_heading-${index}`}>
|
||||
<a
|
||||
class="toc_a"
|
||||
href={`#${heading.slug}`}
|
||||
>
|
||||
{heading.text}
|
||||
</a>
|
||||
{heading.subheadings.length > 0 && (
|
||||
<ul>
|
||||
<For each={heading.subheadings}>
|
||||
{subheading => (
|
||||
<Heading
|
||||
heading={subheading}
|
||||
index={subheading.depth}
|
||||
/>
|
||||
)}
|
||||
</For>
|
||||
</ul>
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue