@@ -141,4 +150,12 @@ const year = new Date().getFullYear();
gap: 2rem;
}
}
+
+ /* Icon beside the word, never instead of it. A footer is scanned, and a column of bare
+ glyphs makes the reader stop and decode where they were skimming. */
+ .site-footer__link--mark {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.45rem;
+ }
diff --git a/src/components/Header.astro b/src/components/Header.astro
index 85a9524..a1c1040 100644
--- a/src/components/Header.astro
+++ b/src/components/Header.astro
@@ -1,11 +1,15 @@
---
import logoUrl from '../assets/logo.svg?url';
+import Icon from './Icon.astro';
+// `icon` marks the links that become a mark on desktop. Their `label` is still the accessible
+// name — an icon-only link without one is a link a screen reader announces as its href.
const navLinks = [
{ label: 'Docs', href: 'https://green-tea.expressive-tea.io/docs', external: true },
{ label: 'Blog', href: '/blog', external: false },
- { label: 'GitHub', href: 'https://github.com/Expressive-Tea/green-tea', external: true },
- { label: 'npm', href: 'https://www.npmjs.com/package/@green-tea/core', external: true },
+ { label: 'GitHub', href: 'https://github.com/Expressive-Tea/green-tea', external: true, icon: 'github' as const },
+ { label: 'npm', href: 'https://www.npmjs.com/package/@green-tea/core', external: true, icon: 'npm' as const },
+ { label: 'JSR', href: 'https://jsr.io/@green-tea/core', external: true, icon: 'jsr' as const },
];
---
@@ -28,8 +32,15 @@ const navLinks = [
{
navLinks.map((link) => (
))
@@ -109,6 +120,23 @@ const navLinks = [
text-decoration: none;
}
+ .site-nav__mark {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.5rem;
+ }
+
+ /* The mark carries the meaning on desktop, where the row is short and the three logos read
+ faster than three words. The label is not removed from the DOM: it is the accessible name
+ the collapsed menu shows back. */
+ .site-nav__mark-text {
+ display: none;
+ }
+
+ .site-nav ul {
+ gap: 1.75rem;
+ }
+
.nav-toggle {
display: none;
}
@@ -148,6 +176,12 @@ const navLinks = [
padding-block: 1rem;
}
+ /* Inside the drawer the row is vertical and there is room, so the mark stops standing in
+ for the word and stands next to it. Three unlabelled logos stacked read as decoration. */
+ .site-nav__mark-text {
+ display: inline;
+ }
+
.nav-toggle:checked ~ .site-nav {
display: block;
}
diff --git a/src/components/Icon.astro b/src/components/Icon.astro
new file mode 100644
index 0000000..6d4a5fd
--- /dev/null
+++ b/src/components/Icon.astro
@@ -0,0 +1,49 @@
+---
+// Inline marks for the three places a package of ours can be reached. Three icons did not
+// justify an icon library: `astro-icon` and friends pull a resolver and a set to ship what
+// fits in this file, and every one of them ends up inlining the same paths anyway.
+//
+// `currentColor` rather than a fixed fill, so a mark takes the colour of the link it sits in
+// and needs no separate rule per surface — the header, the hero's ghost buttons and the
+// footer all tint it differently today.
+//
+// The SVG is `aria-hidden`: the accessible name belongs to the anchor, which knows where it
+// goes. A `` here would announce "GitHub" twice on a link already labelled GitHub.
+interface Props {
+ name: 'github' | 'npm' | 'jsr';
+ size?: number;
+ class?: string;
+}
+
+const { name, size = 18, class: className } = Astro.props;
+
+// Optical sizing, not geometric. GitHub and npm fill their 24×24 box; JSR's wordmark is wide
+// and short and covers about half its height, so at an equal `size` it reads as the small one
+// of the three. The multiplier matches apparent weight, which is what a row of marks is judged
+// on — nobody measures them, they just notice one looks wrong.
+const scale: Record = { github: 1, npm: 1, jsr: 1.4 };
+const box = Math.round(size * scale[name]);
+
+// The marks are the official ones, taken from simple-icons rather than redrawn. Hand-drawn
+// approximations of npm and JSR were tried first and rendered as illegible shapes: a
+// third-party mark is either theirs or it is noise.
+const paths: Record = {
+ github:
+ 'M12 .5C5.37.5 0 5.87 0 12.5c0 5.3 3.44 9.8 8.21 11.39.6.11.82-.26.82-.58 0-.29-.01-1.24-.02-2.25-3.34.73-4.04-1.42-4.04-1.42-.55-1.39-1.34-1.76-1.34-1.76-1.09-.75.08-.73.08-.73 1.2.08 1.84 1.24 1.84 1.24 1.07 1.83 2.81 1.3 3.5.99.11-.78.42-1.3.76-1.6-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.13-.3-.54-1.52.11-3.18 0 0 1.01-.32 3.3 1.23a11.5 11.5 0 0 1 6.01 0c2.29-1.55 3.3-1.23 3.3-1.23.65 1.66.24 2.88.12 3.18.77.84 1.23 1.91 1.23 3.22 0 4.61-2.8 5.62-5.48 5.92.43.37.81 1.1.81 2.22 0 1.6-.01 2.9-.01 3.29 0 .32.21.7.82.58A12 12 0 0 0 24 12.5C24 5.87 18.63.5 12 .5Z',
+ npm: 'M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0zM5.13 5.323l13.837.019-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113z',
+ // the others rather than carrying its own viewBox.
+ jsr: 'M3.692 5.538v3.693H0v7.384h7.385v1.847h12.923v-3.693H24V7.385h-7.385V5.538Zm1.846 1.847h1.847v7.384H1.846v-3.692h1.846v1.846h1.846zm3.693 0h5.538V9.23h-3.692v1.846h3.692v5.538H9.231V14.77h3.692v-1.846H9.231Zm7.384 1.846h5.539v3.692h-1.846v-1.846h-1.846v5.538h-1.847z',
+};
+---
+
+
diff --git a/src/components/sections/Hero.astro b/src/components/sections/Hero.astro
index b818dd8..868eff3 100644
--- a/src/components/sections/Hero.astro
+++ b/src/components/sections/Hero.astro
@@ -1,5 +1,6 @@
---
import logoUrl from '../../assets/logo.svg?url';
+import Icon from '../Icon.astro';
import GraphMotif from '../GraphMotif.astro';
---
@@ -25,11 +26,14 @@ import GraphMotif from '../GraphMotif.astro';
Get started
-
- GitHub
+
+
-
- npm
+
+
+
+
+
@@ -101,6 +105,17 @@ import GraphMotif from '../GraphMotif.astro';
color: var(--ink);
}
+ /* Square rather than pill: with the text gone the ghost button's horizontal padding left a
+ wide box around a small mark. Equal padding keeps the three the same size whatever the
+ glyph's width. */
+ .btn--mark {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ padding: 0.65rem;
+ aspect-ratio: 1;
+ }
+
.hero__ctas {
margin-bottom: 1.4rem;
}