import { icons } from 'lucide-react-native';

const Icon = ({
  name,
  color,
  size,
}: {
  name: string;
  color: string;
  size: number;
}) => {
  // we need to convert the name to pascal case
  const pascalCaseName = name.replace(/(^\w|-\w)/g, (match) =>
    match.toUpperCase().replace('-', '')
  );
  // @ts-ignore
  const LucideIcon = icons[pascalCaseName];

  return <LucideIcon color={color} size={size} />;
};

export default Icon;
