From de78d82d7a570133eb436ac8ae2f4382fedfdb32 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Sun, 5 May 2024 21:53:44 -0700 Subject: [PATCH] feat: sticky position toc below header --- src/lib/components/Blog/Article.svelte | 26 ------------------ src/lib/components/Blog/ArticleHeader.svelte | 29 ++++++++++++++++++++ src/routes/blog/[...slug]/+page.svelte | 13 +++++++-- 3 files changed, 39 insertions(+), 29 deletions(-) create mode 100644 src/lib/components/Blog/ArticleHeader.svelte diff --git a/src/lib/components/Blog/Article.svelte b/src/lib/components/Blog/Article.svelte index 7fd9713..3d8a0ff 100644 --- a/src/lib/components/Blog/Article.svelte +++ b/src/lib/components/Blog/Article.svelte @@ -1,34 +1,8 @@
- -
-
-

- {doc.title} -

-

- {doc.blurb} -

- -
-
- {doc.image.alt} -
{doc.image.caption}
-
-
-
{@html doc.content}
diff --git a/src/lib/components/Blog/ArticleHeader.svelte b/src/lib/components/Blog/ArticleHeader.svelte new file mode 100644 index 0000000..b2a024a --- /dev/null +++ b/src/lib/components/Blog/ArticleHeader.svelte @@ -0,0 +1,29 @@ + + + +
+
+

+ {doc.title} +

+

+ {doc.blurb} +

+ +
+
+ {doc.image.alt} +
{doc.image.caption}
+
+
diff --git a/src/routes/blog/[...slug]/+page.svelte b/src/routes/blog/[...slug]/+page.svelte index fa3371f..dc37a75 100644 --- a/src/routes/blog/[...slug]/+page.svelte +++ b/src/routes/blog/[...slug]/+page.svelte @@ -7,6 +7,7 @@ import '$lib/styles/katex.css' import '$lib/styles/markdown.css' import '$lib/styles/tokyo-night-dark.min.css' + import ArticleHeader from '$lib/components/Blog/ArticleHeader.svelte' const tocStore = createTocStore() @@ -33,7 +34,13 @@ -
+
+
+ +
+
+ +
-