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
5 changes: 2 additions & 3 deletions frontend/components/catalogue/Shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Link from "next/link";
import { GITHUB_URL } from "@/lib/site-config";
import styles from "./catalogue.module.css";
import { Sprite } from "./Sprite";
import { SupportNavLink } from "./SupportNavLink";
import { ThemeToggle } from "./ThemeToggle";
import { TrackedCtaLink } from "./TrackedCtaLink";

Expand All @@ -22,9 +23,7 @@ export function Shell({ children }: { children: React.ReactNode }) {
<nav aria-label="Primary" className={styles.nav}>
<Link href="/#specimens">Specimens</Link>
<Link href="/#services">Services</Link>
<Link href="/support" className={styles.navQuiet}>
Support
</Link>
<SupportNavLink />
<TrackedCtaLink
href={GITHUB_URL}
target="_blank"
Expand Down
19 changes: 19 additions & 0 deletions frontend/components/catalogue/SupportNavLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"use client";

import Link from "next/link";
import { usePathname } from "next/navigation";
import styles from "./catalogue.module.css";

export function SupportNavLink() {
const pathname = usePathname();

return (
<Link
href="/support"
className={styles.navQuiet}
aria-current={pathname === "/support" ? "page" : undefined}
>
Support
</Link>
);
}
64 changes: 38 additions & 26 deletions frontend/components/catalogue/catalogue.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
min-height: 44px;
padding: 0 10px;
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.1em;
text-transform: uppercase;
color: var(--ink) !important;
Expand Down Expand Up @@ -130,7 +130,7 @@
.eyebrow {
margin: 0 0 14px;
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.14em;
text-transform: uppercase;
color: var(--muted);
Expand Down Expand Up @@ -220,7 +220,7 @@
border-radius: 4px;
border: 1px solid var(--ink);
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.1em;
text-transform: uppercase;
text-decoration: none;
Expand Down Expand Up @@ -315,7 +315,7 @@
border-top: 2px solid var(--ink);
border-bottom: 1px solid var(--ink);
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
font-weight: 400;
letter-spacing: 0.12em;
text-transform: uppercase;
Expand All @@ -328,7 +328,7 @@
padding-top: 14px;
padding-bottom: 14px;
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.08em;
text-transform: uppercase;
}
Expand All @@ -338,7 +338,7 @@
}
.cellNo {
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
color: var(--muted);
width: 56px;
}
Expand Down Expand Up @@ -366,7 +366,7 @@
.tbd {
display: inline-block;
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.04em;
color: var(--muted);
background: repeating-linear-gradient(-45deg, transparent 0 5px, var(--line) 5px 6px);
Expand All @@ -378,12 +378,12 @@
}
.quiet {
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
color: var(--muted);
}
.coveredText {
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
}
.meter {
display: block;
Expand Down Expand Up @@ -451,7 +451,7 @@
}
.specs dt {
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.12em;
text-transform: uppercase;
color: var(--muted);
Expand Down Expand Up @@ -506,7 +506,7 @@
}
.menuPrice small {
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.1em;
text-transform: uppercase;
color: var(--muted);
Expand Down Expand Up @@ -545,9 +545,10 @@
display: inline-flex;
align-items: center;
min-height: 44px;
min-width: 24px;
padding: 0 10px 0 0;
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.1em;
text-transform: uppercase;
}
Expand Down Expand Up @@ -601,7 +602,7 @@
.table td::before {
content: attr(data-label);
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.12em;
text-transform: uppercase;
color: var(--muted);
Expand Down Expand Up @@ -753,6 +754,12 @@
.detailEmpty {
color: var(--muted);
}
.detailEmpty a {
display: inline-flex;
align-items: center;
min-width: 24px;
min-height: 24px;
}
@media (max-width: 860px) {
.table tbody tr.rowTbd td.hideTbd {
display: none;
Expand Down Expand Up @@ -780,9 +787,14 @@
.nav a.navQuiet {
color: var(--muted) !important;
}
.nav a.navQuiet:hover {
.nav a.navQuiet:hover,
.nav a[aria-current="page"] {
color: var(--ink) !important;
}
.nav a[aria-current="page"] {
text-decoration: underline;
text-underline-offset: 4px;
}

/* hero figure card */
.figure {
Expand Down Expand Up @@ -819,7 +831,7 @@
transform: translateX(-50%);
margin-top: 2px;
font-family: var(--font-cat-mono), monospace;
font-size: 10px;
font-size: 12px;
letter-spacing: 0.1em;
text-transform: uppercase;
white-space: nowrap;
Expand Down Expand Up @@ -877,7 +889,7 @@
font-style: normal;
font-weight: 400;
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.12em;
text-transform: uppercase;
margin-right: 6px;
Expand Down Expand Up @@ -944,7 +956,7 @@
.plateNo {
margin: 0 0 8px;
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.14em;
text-transform: uppercase;
color: var(--muted);
Expand Down Expand Up @@ -990,7 +1002,7 @@
.field dt {
padding-top: 3px;
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.12em;
text-transform: uppercase;
color: var(--muted);
Expand All @@ -1010,7 +1022,7 @@
}
.chip {
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--muted);
Expand All @@ -1022,7 +1034,7 @@
min-height: 44px;
padding: 0 6px;
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.1em;
text-transform: uppercase;
}
Expand Down Expand Up @@ -1065,7 +1077,7 @@
min-height: 44px;
margin-top: 12px;
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.1em;
text-transform: uppercase;
}
Expand Down Expand Up @@ -1103,7 +1115,7 @@
padding: 0;
list-style: none;
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.1em;
text-transform: uppercase;
color: var(--muted);
Expand Down Expand Up @@ -1138,7 +1150,7 @@
}
.upkeep strong {
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
font-weight: 400;
letter-spacing: 0.12em;
text-transform: uppercase;
Expand Down Expand Up @@ -1169,7 +1181,7 @@
}
.pager small {
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.12em;
text-transform: uppercase;
color: var(--muted);
Expand Down Expand Up @@ -1280,7 +1292,7 @@
display: block;
margin-bottom: 10px;
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
letter-spacing: 0.12em;
text-transform: uppercase;
color: var(--muted);
Expand Down Expand Up @@ -1370,7 +1382,7 @@
.subhead {
margin: 40px 0 12px;
font-family: var(--font-cat-mono), monospace;
font-size: 11px;
font-size: 12px;
font-weight: 400;
letter-spacing: 0.12em;
text-transform: uppercase;
Expand Down
81 changes: 81 additions & 0 deletions frontend/test/site-browser.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,87 @@ test("homepage renders the specimen plates and the theme toggle flips and persis
assert.deepEqual(errors, []);
});

test("the primary navigation marks Support only while its page is current", {
timeout: 20_000,
}, async (t) => {
const page = await localPage(t);
await page.goto(`${baseUrl}/support`, { waitUntil: "networkidle" });
const nav = page.getByRole("navigation", { name: "Primary" });
const support = nav.getByRole("link", { name: "Support", exact: true });
assert.equal(await support.getAttribute("aria-current"), "page");
assert.equal(
await support.evaluate((link) => getComputedStyle(link).textDecorationLine),
"underline",
);
assert.equal(
await support.evaluate((link) => getComputedStyle(link).color),
await nav
.getByRole("link", { name: "Specimens" })
.evaluate((link) => getComputedStyle(link).color),
);

await nav.getByRole("link", { name: "Specimens" }).click();
await page.waitForURL(`${baseUrl}/#specimens`);
assert.equal(await nav.locator('[aria-current="page"]').count(), 0);
await support.click();
await page.waitForURL(`${baseUrl}/support`);
await page.waitForFunction(
() => document.querySelector('nav a[href="/support"]')?.getAttribute("aria-current") === "page",
);
await page.goBack();
await page.waitForURL(`${baseUrl}/#specimens`);
await page.waitForFunction(() => !document.querySelector('nav [aria-current="page"]'));
});

test("catalogue link targets and mono labels remain readable on desktop and mobile", {
timeout: 20_000,
}, async (t) => {
const page = await localPage(t);
for (const viewport of [
{ width: 1440, height: 900 },
{ width: 390, height: 844 },
]) {
await page.setViewportSize(viewport);
for (const path of ["/", "/support", "/projects/sockguard"]) {
await page.goto(`${baseUrl}${path}`, { waitUntil: "networkidle" });
const x = page
.locator("footer")
.getByRole("link", { name: "X (opens in a new tab)", exact: true });
const targets = [x];
if (path === "/support") targets.push(page.getByRole("link", { name: "tier", exact: true }));
for (const target of targets) {
const box = await target.boundingBox();
assert.ok(
box && box.width >= 24 && box.height >= 24,
`${path}: link target must be at least 24px in both dimensions`,
);
}
const smallLabels = await page.locator("header, main, footer").evaluateAll((regions) =>
regions.flatMap((region) =>
[...region.querySelectorAll("*")]
.filter((element) => {
const style = getComputedStyle(element);
const box = element.getBoundingClientRect();
return (
box.width > 1 &&
box.height > 1 &&
element.textContent?.trim() &&
style.fontFamily.includes("mono") &&
Number.parseFloat(style.fontSize) < 12
);
})
.map((element) => element.textContent.trim().slice(0, 60)),
),
);
assert.deepEqual(smallLabels, [], `${path}: mono labels must be at least 12px`);
assert.ok(
await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth),
`${path}: no horizontal overflow`,
);
}
}
});

test("light is the default paper when the system has no dark preference", {
timeout: 15_000,
}, async (t) => {
Expand Down
Loading