Import source: app/src/lib/icon
Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality.
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
// Renders an imported `.svg` icon URL as a currentColor mask-icon (see `.tek-icon`
|
||||||
|
// in global.css), or passes a text glyph through unchanged. Used at render sites
|
||||||
|
// whose data arrays mix SVG icons with non-emoji text symbols (arrows, geometric
|
||||||
|
// bullets, ✓/✗). Icons are imported per use site as plain `.svg` files — this is a
|
||||||
|
// thin render switch, not a name-keyed icon registry.
|
||||||
|
export function iconNode(value, style) {
|
||||||
|
if (typeof value === 'string' && value.endsWith('.svg')) {
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className="tek-icon"
|
||||||
|
aria-hidden="true"
|
||||||
|
style={style ? { ['--i']: `url("${value}")`, ...style } : { ['--i']: `url("${value}")` }}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user