2024-08-19 17:14:09 -05:00
|
|
|
import React, { forwardRef } from "react";
|
|
|
|
import * as Icons from "@phosphor-icons/react";
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
icon: string;
|
|
|
|
} & Icons.IconProps;
|
|
|
|
|
2024-08-26 18:56:04 -05:00
|
|
|
const Icon = forwardRef<SVGSVGElement, Props>(({ icon, ...rest }, ref) => {
|
2024-08-19 17:14:09 -05:00
|
|
|
const IconComponent: any = Icons[icon as keyof typeof Icons];
|
|
|
|
|
|
|
|
if (!IconComponent) {
|
2024-08-26 18:56:04 -05:00
|
|
|
return null;
|
|
|
|
} else return <IconComponent ref={ref} {...rest} />;
|
2024-08-19 17:14:09 -05:00
|
|
|
});
|
|
|
|
|
2024-09-04 21:29:54 -05:00
|
|
|
Icon.displayName = "Icon";
|
|
|
|
|
2024-08-19 17:14:09 -05:00
|
|
|
export default Icon;
|