// Lucide icon wrapper — copies real Lucide SVGs from the CDN global into a
// React-controlled span. Size via the span; stroke-width via app.css (.ic svg).
function Icon({ name, size = 16, style, className }) {
  const ref = React.useRef(null);
  React.useEffect(() => {
    const el = ref.current;
    if (!el || !window.lucide) return;
    el.innerHTML = '<i data-lucide="' + name + '"></i>';
    try { window.lucide.createIcons(); } catch (e) {}
  }, [name]);
  return (
    <span
      ref={ref}
      className={'ic' + (className ? ' ' + className : '')}
      style={{ display: 'inline-flex', width: size, height: size, ...style }}
    />
  );
}

Object.assign(window, { Icon });
