The site linked to GitHub and npm and said nothing about JSR, which core has published to since 26.8.0-beta.1. A reader on Deno had no way in from here. The three become marks rather than words. In a header row of five items, three logos are read faster than three nouns, and the words were carrying no information a logo does not — nobody needs to be told what "GitHub" is. The footer keeps both, because a footer is scanned and a column of bare glyphs makes the reader stop and decode where they were skimming. Each mark is inline SVG in one component. Three icons did not justify an icon library: the resolver and the set weigh more than the paths, and every one of them ends up inlining the same paths anyway. The paths are the official ones from simple-icons. Hand-drawn approximations were tried first and rendered as illegible shapes — verified in a screenshot, not in the markup, because the generated HTML was correct in both cases. A third-party mark is either theirs or it is noise. JSR carries an optical multiplier: its wordmark is wide and short and covers about half the viewBox height, so at an equal size it read as the small one of the three. Icon-only links take the label as `aria-label`. Inside the collapsed mobile menu the label comes back beside the mark, where the row is vertical and three unlabelled logos read as decoration. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
50 lines
2.9 KiB
Plaintext
50 lines
2.9 KiB
Plaintext
---
|
||
// 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 `<title>` 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<Props['name'], number> = { 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<Props['name'], string> = {
|
||
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',
|
||
};
|
||
---
|
||
|
||
<svg
|
||
class={className}
|
||
width={box}
|
||
height={box}
|
||
viewBox="0 0 24 24"
|
||
fill="currentColor"
|
||
aria-hidden="true"
|
||
focusable="false"
|
||
>
|
||
<path d={paths[name]} />
|
||
</svg>
|