All files / components/Button Button.tsx

100% Statements 19/19
100% Branches 3/3
100% Functions 1/1
100% Lines 19/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 291x 6x 6x 6x 6x 6x 6x           6x 6x 6x   6x 6x 6x 6x 6x   6x 6x   6x   1x  
const Button = ({
  children,
  onClick,
  disabled = false,
  className = "",
  variant = "primary",
}: {
  children: React.ReactNode;
  onClick?: () => void;
  disabled?: boolean;
  className?: string;
  variant?: "primary" | "secondary";
}) => {
  const variantClasses =
    variant === "primary" ? "bg-blue-500 text-white" : "bg-gray-500 text-black";
 
  return (
    <button
      className={`${variantClasses} ${className} rounded p-2`}
      disabled={disabled}
      onClick={onClick}
    >
      {children}
    </button>
  );
};
 
export default Button;