import { Button, ButtonProps } from './button';

interface IconButtonProps extends Omit<ButtonProps, 'loading'> {
  icon: React.ReactNode;
  label: string; // For accessibility
  isLoading?: boolean;
}

export const IconButton = ({
  icon,
  label,
  isLoading = false,
  variant = 'ghost',
  size = 'icon',
  ...props
}: IconButtonProps) => {
  return (
    <Button
      variant={variant}
      size={size}
      loading={isLoading}
      aria-label={label}
      {...props}
    >
      {!isLoading && icon}
    </Button>
  );
};
