import * as React from 'react'; import styles from './Button.module.scss'; type ButtonVariant = 'primary' | 'accent' | 'secondary' | 'ghost' | 'danger'; type ButtonSize = 'md' | 'sm'; interface IButtonProps extends React.ButtonHTMLAttributes { variant?: ButtonVariant; size?: ButtonSize; fullWidth?: boolean; } const variantClass: Record = { primary: styles.primary, accent: styles.accent, secondary: styles.secondary, ghost: styles.ghost, danger: styles.danger }; export const Button: React.FC = ({ variant = 'secondary', size = 'md', fullWidth = false, type = 'button', className, children, ...rest }) => { const classes = [ styles.btn, variantClass[variant], size === 'sm' ? styles.sm : '', fullWidth ? styles.full : '', className ] .filter(Boolean) .join(' '); // type по умолчанию 'button', чтобы кнопки внутри формы не сабмитили её случайно. return ( ); };