import React from 'react';
import styles from './Button.module.css';

interface ButtonProps {
  label: string;
  onClick: () => void;
  variant?: 'primary' | 'secondary' | 'danger';
  disabled?: boolean;
  loading?: boolean;
}

export const Button: React.FC<ButtonProps> = ({
  label, onClick, variant = 'primary', disabled = false, loading = false,
}) => (
  <button
    className={`${styles.btn} ${styles[variant]}`}
    onClick={onClick}
    disabled={disabled || loading}
    aria-busy={loading}
  >
    {loading ? <span className={styles.spinner} aria-hidden /> : null}
    {label}
  </button>
);
