Skip to content

Commit 318c53a

Browse files
committed
docs: persistent repo link, nav cleanup, pager + highlight fixes
- Add a persistent 'GitHub repo' link in the sidebar header, tucked under the logo above the divider, on every page - Move 'What's in the repo' back under Get started with its sibling sections - Fix sidebar active state so the current section reads as a location, not a stuck hover (Introduction no longer stays highlighted on scroll) - Rewrite the prev/next pager: page-level only, order + labels matched to the sidebar nav (fixes Audit showing Patterns / Accessibility check)
1 parent d0b0e06 commit 318c53a

2 files changed

Lines changed: 28 additions & 11 deletions

File tree

docs/docs.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ body {
3232
always visible without scrolling the sidebar. */
3333
.docs-logo-row {
3434
display: flex; align-items: stretch;
35-
border-bottom: 1px solid var(--border-light);
3635
}
3736
.docs-logo-row .docs-logo {
3837
border-bottom: 0;
@@ -68,6 +67,18 @@ body {
6867
font-family: var(--font-mono);
6968
}
7069

70+
/* persistent repo link — tucked under the logo, above the header divider,
71+
left-aligned with the logo mark and the nav labels */
72+
.docs-repo-link {
73+
display: flex; align-items: center; gap: var(--space-4);
74+
padding: 0 var(--space-20) var(--space-16);
75+
border-bottom: 1px solid var(--border-light);
76+
font-size: var(--text-md); color: var(--text-secondary); line-height: 1.4;
77+
transition: color var(--duration-fast);
78+
}
79+
.docs-repo-link:hover { color: var(--brand); }
80+
.docs-repo-link:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-xs); }
81+
7182
.docs-nav { padding: var(--space-12) 0 var(--space-32); flex: 1; }
7283
.docs-nav-group { padding: var(--space-12) var(--space-12); }
7384
.docs-nav-group + .docs-nav-group { border-top: 1px solid var(--border-light); }

docs/docs.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
<button class="theme-toggle-icon" data-theme-toggle onclick="toggleTheme()" aria-label="Toggle theme" title="Toggle theme"></button>
3030
</div>
3131
32+
<a class="docs-repo-link" href="https://github.com/LinzLos/tiny-wire" target="_blank" rel="noopener">GitHub repo ↗</a>
33+
3234
<nav class="docs-nav">
3335
<div class="docs-nav-group">
3436
<a class="docs-nav-group-label" href="index.html">Get started</a>
@@ -96,11 +98,6 @@
9698
<a class="docs-nav-link" href="patterns.html#login">Login</a>
9799
<a class="docs-nav-link" href="patterns.html#settings">Settings</a>
98100
</div>
99-
100-
<div class="docs-nav-group">
101-
<a class="docs-nav-group-label" href="https://github.com/LinzLos/tiny-wire" target="_blank" rel="noopener">Source</a>
102-
<a class="docs-nav-link" href="https://github.com/LinzLos/tiny-wire" target="_blank" rel="noopener">GitHub repo ↗</a>
103-
</div>
104101
</nav>
105102
106103
<div class="docs-theme-toggle">
@@ -172,6 +169,8 @@
172169
function setupActiveLinks() {
173170
const page = location.pathname.split('/').pop() || 'index.html';
174171
const links = [...document.querySelectorAll(`.docs-nav-link[href*="${page}#"], .docs-nav-link[href^="#"]`)];
172+
// the bare current-page link (e.g. Introduction) is the "top of page" sentinel
173+
const topLink = document.querySelector(`.docs-nav-link[href="${page}"]`);
175174
const sections = [];
176175
links.forEach(l => {
177176
const hash = l.getAttribute('href').split('#')[1];
@@ -188,9 +187,12 @@
188187
if (el.offsetTop <= y) cur = el.id;
189188
});
190189
links.forEach(l => l.classList.remove('active'));
190+
if (topLink) topLink.classList.remove('active');
191191
if (cur) {
192192
const target = sections.find(s => s.el.id === cur);
193193
if (target) target.link.classList.add('active');
194+
} else if (topLink) {
195+
topLink.classList.add('active');
194196
}
195197
}
196198
window.addEventListener('scroll', update, { passive: true });
@@ -458,13 +460,17 @@
458460
function setupPageNav() {
459461
const main = document.querySelector('.docs-main');
460462
if (!main) return;
463+
// PAGES = the docs pages in nav order — ONE stop per page. The pager is a
464+
// page-level device: it moves page → page only. In-page sections (e.g.
465+
// "What's in the repo", a section of index) are reached via the sidebar and
466+
// the on-page TOC, never the pager. Order MUST mirror the sidebar's page order.
461467
const PAGES = [
462-
{ file: 'index.html', title: 'Introduction' },
468+
{ file: 'index.html', title: 'Introduction' },
469+
{ file: 'audit.html', title: 'Audit & changelog' },
470+
{ file: 'a11y.html', title: 'A11y check' },
463471
{ file: 'foundations.html', title: 'Foundations' },
464-
{ file: 'components.html', title: 'Components' },
465-
{ file: 'patterns.html', title: 'Patterns' },
466-
{ file: 'audit.html', title: 'Audit & changelog' },
467-
{ file: 'a11y.html', title: 'Accessibility check' },
472+
{ file: 'components.html', title: 'Components' },
473+
{ file: 'patterns.html', title: 'Patterns' },
468474
];
469475
const here = (location.pathname.split('/').pop() || 'index.html');
470476
const i = PAGES.findIndex(p => p.file === here);

0 commit comments

Comments
 (0)