Skip to content

Commit

Permalink
Add id to news on index page
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechu10 committed Oct 19, 2024
1 parent 8d4a3bd commit a36816c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions assets/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
body {
@apply scroll-smooth;
}

* {
@apply scroll-mt-12;
}
}
2 changes: 1 addition & 1 deletion src/pages/book.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn BookBody(section: String, #[prop(!optional)] doc: Option<String>) -> 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") {
Expand Down
6 changes: 3 additions & 3 deletions src/pages/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,17 @@ fn Counter(initial: i32) -> View {
}


SectionHeading(content="News")
SectionHeading(content="News", id="news")
NewsList {}
}
}
}

#[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)
}
}
Expand Down

0 comments on commit a36816c

Please sign in to comment.