33 lines
660 B
TypeScript
33 lines
660 B
TypeScript
import './Button.css';
|
|
import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
|
|
type ButtonVariant = 'primary' | 'ghost' | 'toggle' | 'outline';
|
|
|
|
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
variant?: ButtonVariant;
|
|
children: ReactNode;
|
|
className?: string;
|
|
}
|
|
|
|
export default function Button({
|
|
variant = 'primary',
|
|
children,
|
|
className = '',
|
|
disabled,
|
|
onClick,
|
|
type = 'button',
|
|
...props
|
|
}: ButtonProps) {
|
|
return (
|
|
<button
|
|
type={type}
|
|
className={`btn btn-${variant} ${className}`}
|
|
onClick={onClick}
|
|
disabled={disabled}
|
|
{...props}
|
|
>
|
|
{children}
|
|
</button>
|
|
);
|
|
}
|