From a36816c6c50230437adf2098991c4e84114a2e17 Mon Sep 17 00:00:00 2001 From: Luke Chu <37006668+lukechu10@users.noreply.github.com> Date: Sat, 19 Oct 2024 16:45:32 +0100 Subject: [PATCH] Add id to news on index page --- assets/index.scss | 4 ++++ src/pages/book.rs | 2 +- src/pages/index.rs | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/assets/index.scss b/assets/index.scss index faf1326..2473b5d 100644 --- a/assets/index.scss +++ b/assets/index.scss @@ -8,4 +8,8 @@ body { @apply scroll-smooth; } + + * { + @apply scroll-mt-12; + } } diff --git a/src/pages/book.rs b/src/pages/book.rs index 51680bf..26d8d2b 100644 --- a/src/pages/book.rs +++ b/src/pages/book.rs @@ -53,7 +53,7 @@ fn BookBody(section: String, #[prop(!optional)] doc: Option) -> View { div(class="flex-none w-44 pt-8 pb-5 px-2 space-y-2 text-sm sticky top-12 max-h-[calc(100vh-3rem)] overflow-y-auto block -ml-44 sm:ml-0") { BookSidebar(section=section, doc=doc) } - div(class="grow-0 min-w-0 px-2 pt-5 pb-10 prose md:w-[80ch] prose-headings:scroll-mt-12") { + div(class="grow-0 min-w-0 px-2 pt-5 pb-10 prose md:w-[80ch]") { mdsycx::MDSycX(body=parsed.body) div(class="mt-6 mr-2 text-right") { diff --git a/src/pages/index.rs b/src/pages/index.rs index f9bce85..b00e833 100644 --- a/src/pages/index.rs +++ b/src/pages/index.rs @@ -145,7 +145,7 @@ fn Counter(initial: i32) -> View { } - SectionHeading(content="News") + SectionHeading(content="News", id="news") NewsList {} } } @@ -153,9 +153,9 @@ fn Counter(initial: i32) -> View { #[cfg_ssr] #[component(inline_props)] -fn SectionHeading(content: &'static str) -> View { +fn SectionHeading(content: &'static str, #[prop(attributes(html, h2))] attributes: Attributes) -> View { view! { - h2(class="text-4xl text-center font-bold mt-20 mb-5") { + h2(class="text-4xl text-center font-bold mt-20 mb-5", ..attributes) { (content) } }