diff --git a/skills/svg-sprite-icons/SKILL.md b/skills/svg-sprite-icons/SKILL.md index b56c4ac..3f45be0 100644 --- a/skills/svg-sprite-icons/SKILL.md +++ b/skills/svg-sprite-icons/SKILL.md @@ -30,6 +30,8 @@ metadata: Icons are stored as individual SVG files, compiled into a single symbol sprite by a script, and rendered through an `Icon` component that references sprite symbols with ``. The browser downloads one sprite file instead of inlining every icon into the JS bundle. +An icon is a glyph that many components show, or a picture with detail, such as a tag or a leaf. A component's own simple mark, a ring, a dot or a tick, is drawn in CSS instead, and a state is never shown by swapping one icon for another. A picture that only points another way is one symbol: the `Icon` component turns it in CSS, as a chevron that points down is turned a quarter to point left or right. + ## Structure ``` diff --git a/skills/ui-component/SKILL.md b/skills/ui-component/SKILL.md index 0c671d2..c7207c0 100644 --- a/skills/ui-component/SKILL.md +++ b/skills/ui-component/SKILL.md @@ -48,7 +48,9 @@ metadata: ``` - Never write global styles in CSS Modules — globals belong only in dedicated files. -- Build simple shapes with HTML+CSS instead of SVG (this scales up to e.g. a burger button animating into a cross). +- Build a component's own simple marks with HTML+CSS instead of SVG: a ring, a dot, a tick, a burger that turns into a cross. Draw them with borders, `clip-path` or a pseudo-element in `currentColor`, at the icons' size and line weight. A glyph that many components show, such as a chevron, stays an icon of the set, and so does a picture with real detail, such as a tag or a leaf. + - A mark that shows a state, such as a tick in a ring or a chevron turned open, is drawn from the state itself (`:checked`, `[aria-pressed='true']`, `[aria-expanded='true']`), never by swapping one icon for another: a swapped icon can flash empty while the browser resolves the new picture, and a drawn shape can animate between the states, as a burger turns into a cross. + - Forced colors drop box shadows and repaint backgrounds, which erases a drawn shape, but keep borders in the system's ink, as they keep an icon's stroke, the highlight's text included where a control is drawn pressed. Draw the shape with a border there: a ring as a border, a filled shape as a top border as tall as the shape, with `background: none`. - Use `currentColor` in icons and similar components (e.g. as SVG `fill`), so consumers set the color via the `color` property. - Write computed values as the source expression, so it's clear where the number comes from: