Browse Source

add a beginning entry to the ToC, so that you can scroll all the way to the top of the page

master
silberengel 3 months ago
parent
commit
dd3699287f
  1. 18
      src/lib/components/publications/TableOfContents.svelte

18
src/lib/components/publications/TableOfContents.svelte

@ -157,6 +157,24 @@ @@ -157,6 +157,24 @@
<!-- TODO: Figure out how to style indentations. -->
<!-- TODO: Make group title fonts the same as entry title fonts. -->
<SidebarGroup>
<!-- Beginning entry - scrolls to top of page -->
{#if depth === 2}
<SidebarItem
label="Beginning"
href="#"
spanClass="px-2 text-ellipsis"
onclick={(e) => {
e.preventDefault();
window.scrollTo({
top: 0,
behavior: 'smooth',
});
onClose?.();
}}
>
<!-- Beginning entry -->
</SidebarItem>
{/if}
<!-- Root entry (publication header) -->
{#if depth === 2}
{@const rootEntry = toc.getRootEntry()}

Loading…
Cancel
Save