import Spinner from "../spinner/Spinner";
import { ButtonProps } from "./Button.interface";
import "./Button.scss";

const Button = ({
  name = "",
  onClick,
  buttonType = "primary",
  disabled,
  loading = false,
  icon = null,
  className,
}: ButtonProps) => {
  return (
    <button onClick={onClick} className={`btn ${buttonType} ${className ?? ''}`} disabled={disabled}>
      {name}
      {icon}
      {loading && <Spinner />}
    </button>
  );
};

export default Button;
