import * as Icons from "lucide-react";

interface FeatureIconProps extends Icons.LucideProps {
  iconName?: string;
  label?: string;
  hasLabel:boolean
}

export const FeatureIcon: React.FC<FeatureIconProps> = ({
  iconName,
  label,
  hasLabel=true,
  ...props
}) => {
  const LucideIcon =
    iconName && iconName in Icons
      ? (Icons[
          iconName as keyof typeof Icons
        ] as React.ComponentType<Icons.LucideProps>)
      : null;

  return (
    <div className="flex flex-col items-center justify-center gap-1 text-sm text-center">
      {LucideIcon && <LucideIcon size={18} {...props} />}
      {hasLabel && <span>{label}</span>}
    </div>
  );
};

export default FeatureIcon;
