import * as React from 'react'; import { cn } from '../../lib/utils'; export interface IconProps extends React.SVGProps { size?: number | string; strokeWidth?: number | string; className?: string; color?: string; circle?: boolean; } export type Icon = React.ForwardRefExoticComponent< IconProps & React.RefAttributes >; export type IconNode = Array<[string, Record]>; export const createIcon = (displayName: string, iconNode: IconNode): Icon => { const IconComponent = React.forwardRef( ( { className, size = 24, strokeWidth = 2, color = 'currentColor', circle, ...props }, ref, ) => { return ( {circle && ( )} {iconNode.map(([tag, attrs], index) => React.createElement(tag, { key: index, ...attrs }), )} ); }, ); IconComponent.displayName = displayName; return IconComponent; };