Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/build_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def render(page: Page, pages: list[Page]) -> str:
<div class="tools">
<button class="search-open icon" type="button" aria-haspopup="dialog" aria-label="Search" title="Search (/)"><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="10.5" cy="10.5" r="6.5"/><path d="M15.5 15.5 21 21"/></svg></button>
<button class="theme icon" type="button" aria-label="Toggle colour theme" title="Theme"><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="8"/><path d="M12 4a8 8 0 0 1 0 16z" class="fill"/></svg></button>
<a class="buy" href="{page.rel('hardware/')}#buy" title="Which ESP32-S3 board should I buy?" aria-label="Which board should I buy?"><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="7" y="7" width="10" height="10" rx="1.5"/><path d="M10 3v4M14 3v4M10 17v4M14 17v4M3 10h4M3 14h4M17 10h4M17 14h4"/></svg><span>Which board?</span></a>
<a class="buy" href="{page.rel('hardware/')}#hw-diagram" title="Hardware: what to connect" aria-label="Hardware diagram"><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="7" y="7" width="10" height="10" rx="1.5"/><path d="M10 3v4M14 3v4M10 17v4M14 17v4M3 10h4M3 14h4M17 10h4M17 14h4"/></svg><span>Hardware</span></a>
<a class="kofi" href="https://ko-fi.com/mattboxx" data-support-open aria-haspopup="dialog" aria-controls="support-dialog" title="Choose GitHub Sponsors or Ko-fi" aria-label="Support Mattboxx Edition"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 20s-7.5-4.6-7.5-10.2A4.3 4.3 0 0 1 12 7a4.3 4.3 0 0 1 7.5 2.8C19.5 15.4 12 20 12 20z"/></svg><span>Support me! <i class="emoji">❤️</i></span></a>
<a class="gh icon" href="{REPO_URL}" aria-label="GitHub" title="Source on GitHub"><svg viewBox="0 0 16 16" aria-hidden="true"><path class="fill" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg></a>
<button class="menu icon" type="button" aria-expanded="false" aria-controls="site-nav" aria-label="Menu"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h16M4 12h16M4 17h16"/></svg></button>
Expand Down
11 changes: 10 additions & 1 deletion tools/test_site_browser.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const server = http.createServer((req, res) => {
fs.createReadStream(file).pipe(res);
});

const viewports = [[320, 640], [360, 740], [390, 844], [430, 932], [768, 1024], [1024, 768], [1440, 900], [1920, 1080], [844, 390]];
const viewports = [[320, 640], [360, 740], [390, 844], [430, 932], [768, 1024], [820, 1180], [1024, 768], [1180, 820], [1440, 900], [1920, 1080], [844, 390]];
const pages = fs.readdirSync(root, { withFileTypes: true }).filter(d => d.isDirectory() && fs.existsSync(path.join(root, d.name, 'index.html'))
&& !/noindex/.test(fs.readFileSync(path.join(root, d.name, 'index.html'), 'utf8'))).map(d => d.name + '/');
pages.unshift('');
Expand Down Expand Up @@ -108,6 +108,15 @@ pages.unshift('');
}
await page.goto(base, { waitUntil: 'load' });
if (width > 760 && await page.isVisible('.menu')) failures.push(`${width}: mobile menu button visible on a wide screen`);
// Tablets (iPad) and desktops: the name, the links and the icons never overlap.
if (width > 760 && await page.evaluate(() => {
const r = s => document.querySelector(s).getBoundingClientRect();
const name = r('.brand > span'), nav = r('.site-nav'), tools = r('.tools');
return name.right > nav.left + 1 || nav.right > tools.left + 1;
})) failures.push(`${width}: header name, links or icons overlap`);
// The chip icon opens the hardware diagram, fully below the header.
if (!(await page.getAttribute('.tools .buy', 'href') || '').endsWith('hardware/#hw-diagram'))
failures.push(`${width}: chip icon does not open the hardware diagram`);
if (width > 760 && !(await page.isVisible('#site-nav'))) failures.push(`${width}: main navigation hidden on a wide screen`);
await page.click('.search-open');
await page.fill('#search-input', 'headscale');
Expand Down
8 changes: 6 additions & 2 deletions website/assets/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ p, li { max-width: 72ch; }

.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.top-inner { max-width: var(--max); margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; white-space: nowrap; min-height: 44px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; white-space: nowrap; min-height: 44px; flex-shrink: 0; }
.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 2px 12px; margin: 0; padding: 0; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: 15px; padding: 6px 2px; display: inline-block; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); }
Expand Down Expand Up @@ -236,7 +236,9 @@ summary { cursor: pointer; font-weight: 600; }
}
/* Phones: the name stacks as "Recovery / Gateway" (like the compact logo) so the
* header icons stay on one row; below 344 px only the logo mark remains. */
@media (max-width: 440px) { .brand > span { display: flex; flex-direction: column; line-height: 1.1; } }
/* Phones and tablets (iPad): the name stacks as "Recovery / Gateway" so it never runs
* into the navigation or the header icons. */
@media (max-width: 1199px) { .brand > span { display: flex; flex-direction: column; line-height: 1.1; } }
@media (max-width: 343px) { .brand > span { display: none; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
.release-note { margin: 0 0 2rem; padding: 1rem 1.2rem; border: 1px solid var(--line); border-left: 3px solid #1FC97A; border-radius: 12px; font-size: .94rem; line-height: 1.65; }
Expand All @@ -245,6 +247,8 @@ summary { cursor: pointer; font-weight: 600; }
@media print { .top, .sidebar, .foot, .copy { display: none; } }
/* Interactive hardware diagram (07-hardware, generated by tools/make_hardware_diagram.py). */
svg.hw { display: block; width: 100%; height: auto; font-family: var(--font); }
#hw-diagram { scroll-margin-top: 130px; } /* the header's chip icon lands here, with room above */
@media (max-width: 760px) { #hw-diagram { scroll-margin-top: 96px; } }
svg.hw .hw-bg { fill: var(--surface); }
svg.hw .hw-box, svg.hw .hw-board { fill: var(--card); stroke: var(--line); stroke-width: 1.5; }
svg.hw .hw-opt { fill: var(--card); stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 5 4; }
Expand Down
Loading