--- /** * Icon.astro * --------------------------------------------------------------------------- * Inline mdi (Material Design Icons) renderer. Pulls icon path data at build * time from `@iconify-json/mdi/icons.json` and emits a single inline , so * there is no runtime icon library and no extra requests. The svg inherits * `currentColor`, so color is controlled via text-* utilities or inline style. * * The spec calls for mdi icons everywhere instead of emojis; all spec emoji * references are mapped to mdi names at the call sites. * * Usage: */ import mdi from '@iconify-json/mdi/icons.json'; interface Props { /** mdi icon name WITHOUT prefix, e.g. "briefcase". */ name: string; /** Accessible label. Set when the icon conveys meaning alone (not decorative). */ title?: string; class?: string; /** Override default 1em sizing (rarely needed; prefer class utilities). */ size?: number | string; style?: string; } const { name, title, class: className, size, style } = Astro.props; const icon = (mdi as { icons: Record }).icons[name]; if (!icon) { // Surface missing-icon names during dev so typos are caught immediately. console.warn(`[Icon] unknown mdi icon: "${name}"`); } --- ${title}` : '') + (icon?.body ?? '')} />