From 7cab6ddea5c5886b7db8cff6ff8df008d782645d Mon Sep 17 00:00:00 2001 From: seccodesmith Date: Fri, 23 May 2025 11:23:13 +0200 Subject: [PATCH] feat: implement dynamic Table of Contents in BlogPost component --- src/pages/BlogPost.tsx | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/src/pages/BlogPost.tsx b/src/pages/BlogPost.tsx index 5be2b7c..ea6e401 100644 --- a/src/pages/BlogPost.tsx +++ b/src/pages/BlogPost.tsx @@ -5,7 +5,6 @@ import { NotFound } from './NotFound'; import style from '@styles/BlogPost.module.scss'; -import { get } from 'http'; interface TableOfContentsItem { title: string; @@ -30,6 +29,21 @@ function dedent(str: string): string { return lines.map(line => line.slice(minIndent)).join('\n'); } +const TableOfContents = ({ toc }: { toc: TableOfContentsItem[] }) => { + return ( + + ); +} + export const BlogPost = () => { const { slug } = useParams<{ slug: string }>(); const [post, setPost] = useState(blogPostsData.find(post => post.slug === slug)); @@ -258,25 +272,7 @@ export const BlogPost = () => { {/* Table of Contents */}

Table of Contents

- +
{/* Related Posts */}