// Shared Lucide icon helper for the ChicoryTV UI kit.
// Renders a stroke icon by name into a span. Requires window.lucide (UMD).
function Ico({ n, s = 16, color, style }) {
  const ref = React.useRef(null);
  React.useEffect(() => {
    if (!ref.current || !window.lucide) return;
    ref.current.innerHTML = "";
    const def = window.lucide.icons[n];
    if (!def) return;
    const el = window.lucide.createElement(def);
    el.setAttribute("width", s);
    el.setAttribute("height", s);
    ref.current.appendChild(el);
  });
  return <span ref={ref} style={{ display: "inline-flex", color: color || "currentColor", ...style }} />;
}

window.Ico = Ico;
