import React, {forwardRef} from 'react'; import clsx from 'clsx'; export type IconSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | string; export interface SvgIconProps extends React.SVGAttributes { children?: React.ReactNode; size?: IconSize; color?: string; title?: string; } export const SvgIcon = forwardRef( (props, ref) => { const { attr, size, title, className, color, style, children, viewBox, width, height, ...svgProps } = props; return ( {title && {title}} {children} ); } ); function getSizeClassName(size?: IconSize) { switch (size) { case '2xs': return 'icon-2xs'; case 'xs': return 'icon-xs'; case 'sm': return 'icon-sm'; case 'md': return 'icon-md'; case 'lg': return 'icon-lg'; case 'xl': return 'icon-xl'; default: return size; } }