41 lines
817 B
TypeScript
41 lines
817 B
TypeScript
/**
|
|
* Button - Simple button component with variants
|
|
*
|
|
* @example
|
|
* <Button variant="primary" onClick={() => console.log('clicked')}>
|
|
* Click me
|
|
* </Button>
|
|
*/
|
|
|
|
import React from 'react';
|
|
import styles from './Button.module.css';
|
|
|
|
interface ButtonProps {
|
|
children: React.ReactNode;
|
|
onClick?: () => void;
|
|
variant?: 'primary' | 'secondary' | 'danger';
|
|
disabled?: boolean;
|
|
type?: 'button' | 'submit' | 'reset';
|
|
className?: string;
|
|
}
|
|
|
|
export const Button: React.FC<ButtonProps> = ({
|
|
children,
|
|
onClick,
|
|
variant = 'primary',
|
|
disabled = false,
|
|
type = 'button',
|
|
className,
|
|
}) => {
|
|
return (
|
|
<button
|
|
type={type}
|
|
className={`${styles.button} ${styles[variant]} ${className || ''}`}
|
|
onClick={onClick}
|
|
disabled={disabled}
|
|
>
|
|
{children}
|
|
</button>
|
|
);
|
|
};
|