---
import { icons, type IconName } from "../config/icons";

interface Props {
    name: IconName;
    class?: string;
    "class:list"?: any;
}

const { name, class: className, "class:list": classList } = Astro.props;
const svg = icons[name];

if (!svg) {
    throw new Error(`Icon "${name}" not found in icon registry`);
}
---

<svg
    xmlns="http://www.w3.org/2000/svg"
    viewBox="0 0 24 24"
    width="1em"
    height="1em"
    fill="none"
    class:list={[className, classList]}
    aria-hidden="true"
    set:html={svg}
/>
