21 lines
533 B
TypeScript
21 lines
533 B
TypeScript
import type { LucideProps } from "lucide-react";
|
|
import * as icons from "lucide-react";
|
|
import React from "react";
|
|
|
|
export type TWUILucideIconName = keyof typeof icons;
|
|
|
|
export type TWUILucideIconProps = LucideProps & {
|
|
name: TWUILucideIconName;
|
|
};
|
|
|
|
export default function LucideIcon({ name, ...props }: TWUILucideIconProps) {
|
|
const IconComponent = icons[name] as any;
|
|
|
|
if (!IconComponent) {
|
|
console.warn(`Lucide icon "${name}" not found`);
|
|
return null;
|
|
}
|
|
|
|
return <IconComponent {...props} />;
|
|
}
|