diff --git a/src/components/learn/TableOfContents.astro b/src/components/learn/TableOfContents.astro index d56d47c..4b889e3 100644 --- a/src/components/learn/TableOfContents.astro +++ b/src/components/learn/TableOfContents.astro @@ -10,9 +10,17 @@ * Renders two variants, each responsible for hiding itself at the "wrong" * breakpoint via Tailwind's `lg:` variant, so the page only needs to * include this component once: - * - Mobile ( above the article body. + * - Mobile ( bottom sheet listing + * the same sections. A top-of-article control would scroll out of + * reach on a long article, so this replaces that pattern entirely + * rather than running both (avoids two redundant mobile TOCs). * - Desktop (lg+): a sticky aside rail with scroll-spy highlighting. * + * Both variants share the `.toc-link` class + `data-toc-target` attribute, + * so the single scroll-spy observer below keeps the active-section + * indication in sync in both places at once. + * * The page decides layout/grid placement; this component only owns its own * content and internal responsive visibility. */ @@ -32,18 +40,56 @@ const show = items.length >= 4; {show && ( <> - {/* Mobile: collapsible, closed by default, rendered above the article body */} -
- - On this page - -
+ {/* Desktop: sticky rail with scroll-spy */}