Skip to content

Commit c15eeb3

Browse files
committed
feat(nav): "All parts" home link on every part page + retint .ok green
Two TOC-navigation fixes after seeing the live site. 1. Part pages had no one-click path back to the index — only the numbered Part pills, which all go sideways to other parts. Add a leading `.wt-home-link` in the topbar's .part-nav on every part page, pointing at the root (`/` locally, `/<basePath>/` on GH Pages — the existing applyBasePath rewrite handles it). Chevron prefix (`‹ All parts`) distinguishes it from the numbered pills; slightly brighter border + right margin reinforce the "root vs sibling" grouping. 2. Meander emits the `(N sections)` count on the TOC with class "ok", which gets Chakra green from the upstream CSS. Green clashes with the Socket lavender surface. Override `.ok` to `var(--muted-lavender)` so the count recedes as metadata and the part titles carry the visual weight. Index page has no .part-nav (it IS the index), so the link injection is a no-op there. The ::before chevron is CSS-only; no inline SVG.
1 parent accc291 commit c15eeb3

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

scripts/walkthrough.mts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,21 @@ async function generate(
574574
html = html.replace('</body>', ` ${footerTag}\n</body>`)
575575
}
576576

577+
// Inject a "All parts" home link at the front of the part-nav on
578+
// every part page. Meander's emitted topbar only has the numbered
579+
// Part pills — users clicking a part had no one-click way back to
580+
// the TOC. Index page has no `.part-nav` so the replace is a
581+
// no-op there (the TOC IS the index). Idempotent via class marker.
582+
if (
583+
html.includes('<div class="part-nav">') &&
584+
!html.includes('wt-home-link')
585+
) {
586+
html = html.replace(
587+
'<div class="part-nav">',
588+
'<div class="part-nav"><a class="wt-home-link" href="/" aria-label="Back to the walkthrough index">All parts</a>',
589+
)
590+
}
591+
577592
// Base-path rewrite — last step so every injected tag above gets
578593
// prefixed in one pass. No-op when --base-path is empty (local dev,
579594
// Val Town hosting, etc.).

walkthrough-overrides.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,28 @@ body.wt-ready .topbar-actions {
686686
border-color: rgba(255, 255, 255, 0.7) !important;
687687
font-weight: 600;
688688
}
689+
690+
/* Meander's default `.ok` class is Chakra-green (#16a34a) for positive
691+
* annotations like the "(N sections)" counts on the TOC. Green clashes
692+
* with the Socket lavender surface on the index. Retint to muted
693+
* lavender so the count recedes as metadata and the part titles carry
694+
* the visual weight. */
695+
.ok {
696+
color: var(--muted-lavender) !important;
697+
}
698+
/* "All parts" home link on every part page. Leading chevron makes it
699+
* unambiguous it's a back-nav, not another Part pill. Slight right
700+
* margin + brighter border separate it from the numbered pills so it
701+
* reads as a distinct category ("root" vs "children"). */
702+
.topbar .part-nav a.wt-home-link {
703+
border-color: rgba(255, 255, 255, 0.55) !important;
704+
margin-right: 8px;
705+
}
706+
.topbar .part-nav a.wt-home-link::before {
707+
content: '‹ ';
708+
margin-right: 2px;
709+
opacity: 0.8;
710+
}
689711
/* Dark theme keeps the same purple band — docs.socket.dev uses the
690712
* same header in both modes, deepened slightly against the near-black
691713
* page. */

0 commit comments

Comments
 (0)