From 2bfe90b7e64839d8ec6319fe93b76472b0285114 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Mon, 12 Jun 2023 06:46:38 +0000
Subject: [PATCH] add config to components
---
quartz/components/TableOfContents.tsx | 27 ++++++++++++---------------
1 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/quartz/components/TableOfContents.tsx b/quartz/components/TableOfContents.tsx
index 8192da4..531c61d 100644
--- a/quartz/components/TableOfContents.tsx
+++ b/quartz/components/TableOfContents.tsx
@@ -1,24 +1,21 @@
-import { QuartzComponentProps } from "./types"
+import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
import style from "./styles/toc.scss"
-export default function TableOfContents({ fileData, position }: QuartzComponentProps) {
+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
+
+export default (() => TableOfContents) satisfies QuartzComponentConstructor
--
Gitblit v1.10.0