diff options
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/blog/TOC.astro | 22 | ||||
| -rw-r--r-- | src/components/blog/TOCHeading.astro | 27 |
2 files changed, 0 insertions, 49 deletions
diff --git a/src/components/blog/TOC.astro b/src/components/blog/TOC.astro deleted file mode 100644 index 2a45124..0000000 --- a/src/components/blog/TOC.astro +++ /dev/null @@ -1,22 +0,0 @@ ---- -import type { MarkdownHeading } from "astro"; -import { generateToc } from "@/utils/generateToc"; -import TOCHeading from "./TOCHeading.astro"; - -interface Props { - headings: MarkdownHeading[]; -} - -const { headings } = Astro.props; - -const toc = generateToc(headings); ---- - -<details open class="lg:sticky lg:top-12 lg:order-2 lg:-me-32 lg:basis-64"> - <summary class="title hover:marker:text-accent cursor-pointer text-lg">Table of Contents</summary> - <nav class="ms-4 lg:w-full"> - <ol class="mt-4"> - {toc.map((heading) => <TOCHeading heading={heading} />)} - </ol> - </nav> -</details> diff --git a/src/components/blog/TOCHeading.astro b/src/components/blog/TOCHeading.astro deleted file mode 100644 index b9dd486..0000000 --- a/src/components/blog/TOCHeading.astro +++ /dev/null @@ -1,27 +0,0 @@ ---- -import type { TocItem } from "@/utils/generateToc"; - -interface Props { - heading: TocItem; -} - -const { - heading: { children, depth, slug, text }, -} = Astro.props; ---- - -<li class={`${depth > 2 ? "ms-2" : ""}`}> - <a - class={`line-clamp-2 hover:text-accent ${depth <= 2 ? "mt-3" : "mt-2 text-xs"}`} - href={`#${slug}`}><span aria-hidden="true" class="me-0.5">#</span>{text}</a - > - { - !!children.length && ( - <ol> - {children.map((subheading) => ( - <Astro.self heading={subheading} /> - ))} - </ol> - ) - } -</li> |
