mirror of
https://github.com/alrayyes/wiki.git
synced 2025-06-10 15:33:39 +00:00
refactor plugins to be functions instead of classes
This commit is contained in:
parent
b8c011410d
commit
352075ae81
20 changed files with 464 additions and 507 deletions
quartz/components
|
@ -1,24 +1,19 @@
|
|||
import { QuartzComponentProps } from "./types"
|
||||
import style from "./styles/toc.scss"
|
||||
|
||||
export default function TableOfContents({ fileData, position }: QuartzComponentProps) {
|
||||
export default function TableOfContents({ fileData }: QuartzComponentProps) {
|
||||
if (!fileData.toc) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (position === 'body') {
|
||||
// TODO: animate this
|
||||
return <details className="toc" open>
|
||||
<summary><h3>Table of Contents</h3></summary>
|
||||
<ul>
|
||||
{fileData.toc.map(tocEntry => <li key={tocEntry.slug} className={`depth-${tocEntry.depth}`}>
|
||||
<a href={`#${tocEntry.slug}`}>{tocEntry.text}</a>
|
||||
</li>)}
|
||||
</ul>
|
||||
</details>
|
||||
} else if (position === 'sidebar') {
|
||||
// TODO
|
||||
}
|
||||
return <details class="toc" open>
|
||||
<summary><h3>Table of Contents</h3></summary>
|
||||
<ul>
|
||||
{fileData.toc.map(tocEntry => <li key={tocEntry.slug} class={`depth-${tocEntry.depth}`}>
|
||||
<a href={`#${tocEntry.slug}`}>{tocEntry.text}</a>
|
||||
</li>)}
|
||||
</ul>
|
||||
</details>
|
||||
}
|
||||
|
||||
TableOfContents.css = style
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue