lifetracker/apps/web/components/ui/icon.tsx

15 lines
464 B
TypeScript

"use client";
import { icons } from 'lucide-react';
export const Icon = ({ name = "FileQuestion", color = "white", size = 16, ...props }) => {
const icon = Object.keys(icons).find((i) => i.toLowerCase() == (name.toLowerCase()));
if (!icon) {
return null;
}
const LucideIcon = icons[name as keyof typeof icons]; // Add an index signature to allow indexing with a string
return <LucideIcon color={color} size={size} {...props} />;
};