Add a self-contained icon system: vendored Material Symbols registry, an <Icon> component that references a single <symbol> sprite via <use>, plus IconButton/IconSprite. Replace every emoji/Unicode glyph (logo, theme switcher, cover placeholder, like/comment counts, lightbox controls, back links) and add leading icons to key controls. Decorative icons are aria-hidden; icon-only buttons get labels; theme toggles expose aria-pressed; counters get accessible names. Recorded in openspec change material-icons-ui (all tasks complete).
28 lines
524 B
Svelte
28 lines
524 B
Svelte
<script lang="ts">
|
|
import { icons, type IconName } from '$lib/icons/registry';
|
|
|
|
interface Props {
|
|
name: IconName;
|
|
label?: string;
|
|
class?: string;
|
|
}
|
|
|
|
let { name, label, class: className = 'size-5' }: Props = $props();
|
|
|
|
const known = $derived(name in icons);
|
|
</script>
|
|
|
|
{#if known}
|
|
<svg
|
|
viewBox="0 0 24 24"
|
|
fill="currentColor"
|
|
class={className}
|
|
role={label ? 'img' : undefined}
|
|
aria-label={label}
|
|
aria-hidden={label ? undefined : 'true'}
|
|
focusable="false"
|
|
>
|
|
<use href="#i-{name}" />
|
|
</svg>
|
|
{/if}
|