32 lines
631 B
TypeScript
32 lines
631 B
TypeScript
import { h } from 'preact';
|
|
import type { ButtonProps } from '../../types/ui';
|
|
import styles from './Button.module.css';
|
|
|
|
export function Button({
|
|
variant = 'secondary',
|
|
size = 'medium',
|
|
disabled = false,
|
|
children,
|
|
onClick,
|
|
'aria-label': ariaLabel,
|
|
...rest
|
|
}: ButtonProps) {
|
|
const classNames = [
|
|
styles.button,
|
|
styles[variant],
|
|
styles[size],
|
|
disabled && styles.disabled,
|
|
].filter(Boolean).join(' ');
|
|
|
|
return (
|
|
<button
|
|
className={classNames}
|
|
onClick={onClick}
|
|
disabled={disabled}
|
|
aria-label={ariaLabel}
|
|
{...rest}
|
|
>
|
|
{children}
|
|
</button>
|
|
);
|
|
} |