import { memo } from 'react'; import { classNames } from '~/utils/classNames'; type IconSize = 'sm' | 'md' | 'lg' | 'xl' | 'xxl'; interface BaseIconButtonProps { size?: IconSize; className?: string; iconClassName?: string; disabledClassName?: string; disabled?: boolean; onClick?: (event: React.MouseEvent) => void; } type IconButtonWithoutChildrenProps = { icon: string; children?: undefined; } & BaseIconButtonProps; type IconButtonWithChildrenProps = { icon?: undefined; children: string | JSX.Element | JSX.Element[]; } & BaseIconButtonProps; type IconButtonProps = IconButtonWithoutChildrenProps | IconButtonWithChildrenProps; export const IconButton = memo( ({ icon, size = 'xl', className, iconClassName, disabledClassName, disabled = false, onClick, children, }: IconButtonProps) => { return ( ); }, ); function getIconSize(size: IconSize) { if (size === 'sm') { return 'text-sm'; } else if (size === 'md') { return 'text-md'; } else if (size === 'lg') { return 'text-lg'; } else if (size === 'xl') { return 'text-xl'; } else { return 'text-2xl'; } }