Skip to content
Closed
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 public/r/header-minimal.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"files": [
{
"path": "src/components/blocks/HeaderMinimal.astro",
"content": "---\n// Astro Blocks — header-minimal — MIT — https://github.com/lambda-curry/astro-blocks\nimport type { HTMLAttributes } from \"astro/types\";\nimport Button from \"../ui/Button.astro\";\n\ninterface Link {\n label: string;\n href: string;\n /** Where it opens, such as \"_blank\" for another tab, which also gets rel=\"noopener noreferrer\". */\n target?: string;\n}\ninterface Props extends HTMLAttributes<\"header\"> {\n /** Site name. Used as the home link text, or as the logo's alt text. With a brand slot it names the home link for screen readers. */\n brand: string;\n homeHref?: string;\n logo?: { src: string; alt?: string; width?: number; height?: number };\n /** Two to five links. They wrap onto their own row on narrow screens instead of hiding in a menu. */\n links?: Link[];\n action?: Link;\n /** Draw a hairline under the header. */\n divider?: boolean;\n /** Names the header's navigation for screen readers, such as \"Primary\". */\n navLabel?: string;\n}\n\nconst { brand, homeHref = \"/\", logo, links = [], action, divider = true, navLabel = \"Primary\", class: className, ...attrs } = Astro.props;\n// \"_blank\" opens another tab without handing it this page: rel=\"noopener noreferrer\".\nconst opens = (target?: string) => (target ? { target, rel: target === \"_blank\" ? \"noopener noreferrer\" : undefined } : {});\nconst trim = (path: string) => path.replace(/\\/$/, \"\") || \"/\";\nconst here = trim(Astro.url.pathname);\n// A composed mark (the brand slot) is announced as the brand name, whatever it contains.\nconst composed = Astro.slots.has(\"brand\");\nconst isCurrent = (href: string) => (href.startsWith(\"/\") && !href.startsWith(\"//\") && trim(href) === here ? \"page\" : undefined);\n---\n\n<header {...attrs} class:list={[\"header-minimal\", { divider }, className]}>\n <div class=\"row\">\n <a class=\"brand\" href={homeHref} aria-label={composed ? brand : undefined}>\n <slot name=\"brand\">{logo ? <img src={logo.src} alt={logo.alt ?? brand} width={logo.width} height={logo.height} /> : brand}</slot>\n </a>\n {\n links.length > 0 && (\n <nav aria-label={navLabel}>\n <ul>\n {links.map(({ label, href, target }) => (\n <li>\n <a href={href} {...opens(target)} aria-current={isCurrent(href)}>\n {label}\n </a>\n </li>\n ))}\n </ul>\n </nav>\n )\n }\n {action && <Button class=\"action\" size=\"sm\" variant=\"outline\" href={action.href} {...opens(action.target)}>{action.label}</Button>}\n </div>\n</header>\n\n<style>\n .header-minimal {\n overflow-wrap: anywhere;\n container-type: inline-size;\n color: var(--color-text, #1b1f22);\n }\n .divider {\n border-block-end: 1px solid var(--color-rule, color-mix(in oklab, currentColor 13%, transparent));\n }\n .row {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n align-items: center;\n gap: 0 1.5rem;\n inline-size: min(var(--width-content, 72rem), 100% - 2 * var(--space-gutter, clamp(1.25rem, 4vw, 4rem)));\n margin-inline: auto;\n padding-block: 0.75rem;\n }\n .brand {\n display: inline-flex;\n align-items: center;\n justify-self: start;\n min-block-size: 44px;\n min-inline-size: 44px;\n color: inherit;\n font-family: var(--font-display, system-ui, sans-serif);\n font-size: var(--step-1, clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem));\n font-weight: var(--weight-display, 650);\n letter-spacing: var(--tracking-display, -0.022em);\n line-height: 1.05;\n text-decoration: none;\n overflow-wrap: anywhere;\n }\n .brand img {\n display: block;\n max-block-size: 2.25rem;\n inline-size: auto;\n }\n /* Slotted marks: an inline SVG and the name beside it sit on one line, as tall as a logo image at most. */\n .brand {\n gap: 0.5rem;\n }\n .brand > :global(svg) {\n display: block;\n flex: none;\n inline-size: auto;\n block-size: auto;\n max-block-size: 2.25rem;\n max-inline-size: 60cqi;\n }\n /* A mark with only a viewBox has no size of its own: give it the logo height. */\n .brand > :global(svg:not([height])) {\n block-size: 2.25rem;\n }\n nav {\n grid-column: 1 / -1;\n grid-row: 2;\n margin-inline: -0.625rem;\n }\n ul {\n display: flex;\n flex-wrap: wrap;\n margin: 0;\n padding: 0;\n list-style: none;\n }\n /* Links share the compact action's text size, so neither outranks the other. */\n nav a {\n display: inline-flex;\n align-items: center;\n min-block-size: 44px;\n padding-inline: 0.625rem;\n color: var(--color-muted, #555c62);\n font-size: var(--step--1, clamp(0.875rem, 0.84rem + 0.16vw, 0.95rem));\n text-decoration: none;\n }\n nav a:hover,\n nav a[aria-current=\"page\"] {\n color: inherit;\n }\n nav a[aria-current=\"page\"] {\n text-decoration: underline;\n text-decoration-color: var(--color-accent, #1f4f5f);\n text-decoration-thickness: 2px;\n text-underline-offset: 0.45em;\n }\n :focus-visible {\n outline: 3px solid var(--color-focus, #1f4f5f);\n outline-offset: 2px;\n }\n @container (min-width: 44rem) {\n .row {\n grid-template-columns: minmax(0, 1fr) auto auto;\n padding-block: 1rem;\n }\n nav {\n grid-column: auto;\n grid-row: auto;\n margin-inline: 0;\n }\n }\n</style>\n",
"content": "---\n// Astro Blocks — header-minimal — MIT — https://github.com/lambda-curry/astro-blocks\nimport type { HTMLAttributes } from \"astro/types\";\nimport Button from \"../ui/Button.astro\";\n\ninterface Link {\n label: string;\n href: string;\n /** Where it opens, such as \"_blank\" for another tab, which also gets rel=\"noopener noreferrer\". */\n target?: string;\n}\ninterface Props extends HTMLAttributes<\"header\"> {\n /** Site name. Used as the home link text, or as the logo's alt text. With a brand slot it names the home link for screen readers. */\n brand: string;\n homeHref?: string;\n logo?: { src: string; alt?: string; width?: number; height?: number };\n /** Two to five links. They wrap onto their own row on narrow screens instead of hiding in a menu. */\n links?: Link[];\n action?: Link;\n /** Draw a hairline under the header. */\n divider?: boolean;\n /** Surface the header sits on. \"inverse\" puts it on the dark inverse surface (over or beside a tone=\"inverse\" band) using the theme's inverse tokens; the default keeps the page background. */\n tone?: \"base\" | \"inverse\";\n /** Names the header's navigation for screen readers, such as \"Primary\". */\n navLabel?: string;\n}\n\nconst { brand, homeHref = \"/\", logo, links = [], action, divider = true, navLabel = \"Primary\", tone = \"base\", class: className, ...attrs } = Astro.props;\n// \"_blank\" opens another tab without handing it this page: rel=\"noopener noreferrer\".\nconst opens = (target?: string) => (target ? { target, rel: target === \"_blank\" ? \"noopener noreferrer\" : undefined } : {});\nconst trim = (path: string) => path.replace(/\\/$/, \"\") || \"/\";\nconst here = trim(Astro.url.pathname);\n// A composed mark (the brand slot) is announced as the brand name, whatever it contains.\nconst composed = Astro.slots.has(\"brand\");\nconst isCurrent = (href: string) => (href.startsWith(\"/\") && !href.startsWith(\"//\") && trim(href) === here ? \"page\" : undefined);\n---\n\n<header {...attrs} class:list={[\"header-minimal\", `tone-${tone}`, { divider }, className]}>\n <div class=\"row\">\n <a class=\"brand\" href={homeHref} aria-label={composed ? brand : undefined}>\n <slot name=\"brand\">{logo ? <img src={logo.src} alt={logo.alt ?? brand} width={logo.width} height={logo.height} /> : brand}</slot>\n </a>\n {\n links.length > 0 && (\n <nav aria-label={navLabel}>\n <ul>\n {links.map(({ label, href, target }) => (\n <li>\n <a href={href} {...opens(target)} aria-current={isCurrent(href)}>\n {label}\n </a>\n </li>\n ))}\n </ul>\n </nav>\n )\n }\n {action && <Button class=\"action\" size=\"sm\" variant=\"outline\" href={action.href} {...opens(action.target)}>{action.label}</Button>}\n </div>\n</header>\n\n<style>\n .header-minimal {\n overflow-wrap: anywhere;\n container-type: inline-size;\n color: var(--color-text, #1b1f22);\n }\n /* On the inverse surface, swap to the theme's inverse tokens so the header integrates with a dark hero band instead of leaving a light seam above it. */\n .tone-inverse {\n background: var(--color-inverse, #1b1f22);\n color: var(--color-on-inverse, #ffffff);\n }\n .tone-inverse nav a {\n color: color-mix(in oklab, currentColor 72%, transparent);\n }\n .tone-inverse nav a:hover,\n .tone-inverse nav a[aria-current=\"page\"] {\n color: inherit;\n }\n .tone-inverse :focus-visible {\n outline-color: currentColor;\n }\n .divider {\n border-block-end: 1px solid var(--color-rule, color-mix(in oklab, currentColor 13%, transparent));\n }\n .row {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n align-items: center;\n gap: 0 1.5rem;\n inline-size: min(var(--width-content, 72rem), 100% - 2 * var(--space-gutter, clamp(1.25rem, 4vw, 4rem)));\n margin-inline: auto;\n padding-block: 0.75rem;\n }\n .brand {\n display: inline-flex;\n align-items: center;\n justify-self: start;\n min-block-size: 44px;\n min-inline-size: 44px;\n color: inherit;\n font-family: var(--font-display, system-ui, sans-serif);\n font-size: var(--step-1, clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem));\n font-weight: var(--weight-display, 650);\n letter-spacing: var(--tracking-display, -0.022em);\n line-height: 1.05;\n text-decoration: none;\n overflow-wrap: anywhere;\n }\n .brand img {\n display: block;\n max-block-size: 2.25rem;\n inline-size: auto;\n }\n /* Slotted marks: an inline SVG and the name beside it sit on one line, as tall as a logo image at most. */\n .brand {\n gap: 0.5rem;\n }\n .brand > :global(svg) {\n display: block;\n flex: none;\n inline-size: auto;\n block-size: auto;\n max-block-size: 2.25rem;\n max-inline-size: 60cqi;\n }\n /* A mark with only a viewBox has no size of its own: give it the logo height. */\n .brand > :global(svg:not([height])) {\n block-size: 2.25rem;\n }\n nav {\n grid-column: 1 / -1;\n grid-row: 2;\n margin-inline: -0.625rem;\n }\n ul {\n display: flex;\n flex-wrap: wrap;\n margin: 0;\n padding: 0;\n list-style: none;\n }\n /* Links share the compact action's text size, so neither outranks the other. */\n nav a {\n display: inline-flex;\n align-items: center;\n min-block-size: 44px;\n padding-inline: 0.625rem;\n color: var(--color-muted, #555c62);\n font-size: var(--step--1, clamp(0.875rem, 0.84rem + 0.16vw, 0.95rem));\n text-decoration: none;\n }\n nav a:hover,\n nav a[aria-current=\"page\"] {\n color: inherit;\n }\n nav a[aria-current=\"page\"] {\n text-decoration: underline;\n text-decoration-color: var(--color-accent, #1f4f5f);\n text-decoration-thickness: 2px;\n text-underline-offset: 0.45em;\n }\n :focus-visible {\n outline: 3px solid var(--color-focus, #1f4f5f);\n outline-offset: 2px;\n }\n @container (min-width: 44rem) {\n .row {\n grid-template-columns: minmax(0, 1fr) auto auto;\n padding-block: 1rem;\n }\n nav {\n grid-column: auto;\n grid-row: auto;\n margin-inline: 0;\n }\n }\n</style>\n",
"type": "registry:file",
"target": "~/src/components/blocks/HeaderMinimal.astro"
}
Expand Down
2 changes: 1 addition & 1 deletion public/r/schedule.json

Large diffs are not rendered by default.

21 changes: 19 additions & 2 deletions src/components/blocks/HeaderMinimal.astro
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ interface Props extends HTMLAttributes<"header"> {
action?: Link;
/** Draw a hairline under the header. */
divider?: boolean;
/** Surface the header sits on. "inverse" puts it on the dark inverse surface (over or beside a tone="inverse" band) using the theme's inverse tokens; the default keeps the page background. */
tone?: "base" | "inverse";
/** Names the header's navigation for screen readers, such as "Primary". */
navLabel?: string;
}

const { brand, homeHref = "/", logo, links = [], action, divider = true, navLabel = "Primary", class: className, ...attrs } = Astro.props;
const { brand, homeHref = "/", logo, links = [], action, divider = true, navLabel = "Primary", tone = "base", class: className, ...attrs } = Astro.props;
// "_blank" opens another tab without handing it this page: rel="noopener noreferrer".
const opens = (target?: string) => (target ? { target, rel: target === "_blank" ? "noopener noreferrer" : undefined } : {});
const trim = (path: string) => path.replace(/\/$/, "") || "/";
Expand All @@ -33,7 +35,7 @@ const composed = Astro.slots.has("brand");
const isCurrent = (href: string) => (href.startsWith("/") && !href.startsWith("//") && trim(href) === here ? "page" : undefined);
---

<header {...attrs} class:list={["header-minimal", { divider }, className]}>
<header {...attrs} class:list={["header-minimal", `tone-${tone}`, { divider }, className]}>
<div class="row">
<a class="brand" href={homeHref} aria-label={composed ? brand : undefined}>
<slot name="brand">{logo ? <img src={logo.src} alt={logo.alt ?? brand} width={logo.width} height={logo.height} /> : brand}</slot>
Expand Down Expand Up @@ -63,6 +65,21 @@ const isCurrent = (href: string) => (href.startsWith("/") && !href.startsWith("/
container-type: inline-size;
color: var(--color-text, #1b1f22);
}
/* On the inverse surface, swap to the theme's inverse tokens so the header integrates with a dark hero band instead of leaving a light seam above it. */
.tone-inverse {
background: var(--color-inverse, #1b1f22);
color: var(--color-on-inverse, #ffffff);
}
.tone-inverse nav a {
color: color-mix(in oklab, currentColor 72%, transparent);
}
.tone-inverse nav a:hover,
.tone-inverse nav a[aria-current="page"] {
color: inherit;
}
.tone-inverse :focus-visible {
outline-color: currentColor;
}
.divider {
border-block-end: 1px solid var(--color-rule, color-mix(in oklab, currentColor 13%, transparent));
}
Expand Down
19 changes: 19 additions & 0 deletions src/components/blocks/Schedule.astro
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,25 @@ const styleText = (value: unknown) =>
outline-offset: -2px;
}

/* Narrow phones: wrap the day pills instead of clipping the last one behind a hidden scrollbar. */
@media (max-width: 480px) {
.has-day-nav {
--_below-bar: var(--_sticky-top);
}
.day-nav {
position: static;
inline-size: 100%;
}
.day-nav ul {
flex-wrap: wrap;
overflow-x: visible;
}
.day-nav a {
min-block-size: 40px;
padding-inline: 0.75rem;
}
}

/* Every day is a subgrid of one grid, so the time gutter fits the widest time of the whole programme and
track columns line up from day to day. */
.days {
Expand Down
15 changes: 11 additions & 4 deletions src/data/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -2761,8 +2761,8 @@
"files": [
{
"target": "src/components/blocks/HeaderMinimal.astro",
"bytes": 5230,
"sha256": "76faf4093ed4ca5641db98bb8bf7376d06a6e9115474a48019a487ddf464a61d"
"bytes": 6014,
"sha256": "69a280f40159a569f740d56e3de1f5941520703156b6499cb06c5ec6fb34cf47"
}
],
"import": "../components/blocks/HeaderMinimal.astro",
Expand Down Expand Up @@ -2803,6 +2803,13 @@
"default": "true",
"description": "Draw a hairline under the header."
},
{
"name": "tone",
"type": "\"base\" | \"inverse\"",
"required": false,
"default": "\"base\"",
"description": "Surface the header sits on. \"inverse\" puts it on the dark inverse surface (over or beside a tone=\"inverse\" band) using the theme's inverse tokens; the default keeps the page background."
},
{
"name": "navLabel",
"type": "string",
Expand Down Expand Up @@ -4390,8 +4397,8 @@
"files": [
{
"target": "src/components/blocks/Schedule.astro",
"bytes": 24327,
"sha256": "273315b76d1760235d35119e2cffa571e8a2190f055e797aecab6ad712498996"
"bytes": 24755,
"sha256": "b2e256b23d0c123b652f3ed8bf73912116dbea7191fe17e3ef8f2389a755cb34"
}
],
"import": "../components/blocks/Schedule.astro",
Expand Down
Loading
Loading