24 lines
480 B
TypeScript
24 lines
480 B
TypeScript
|
import { MouseEventHandler } from 'react';
|
||
|
import styles from './Button.module.scss';
|
||
|
|
||
|
export const Button = ({
|
||
|
variant = 'default',
|
||
|
onClick,
|
||
|
children,
|
||
|
...props
|
||
|
}: {
|
||
|
variant?: 'default' | 'primary' | 'secondary';
|
||
|
onClick: MouseEventHandler<HTMLButtonElement>;
|
||
|
children?: React.ReactNode;
|
||
|
}) => {
|
||
|
return (
|
||
|
<button
|
||
|
{...props}
|
||
|
className={[styles.button, styles[variant]].join(' ')}
|
||
|
onClick={onClick}
|
||
|
>
|
||
|
{children}
|
||
|
</button>
|
||
|
);
|
||
|
};
|