({
variant = 'primary',
size = 'md',
children,
className,
disabled,
...props
})
| 8 | } |
| 9 | |
| 10 | const Button: React.FC<ButtonProps> = ({ |
| 11 | variant = 'primary', |
| 12 | size = 'md', |
| 13 | children, |
| 14 | className, |
| 15 | disabled, |
| 16 | ...props |
| 17 | }) => { |
| 18 | const baseClasses = 'font-medium rounded-md transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-background disabled:opacity-50 disabled:cursor-not-allowed'; |
| 19 | |
| 20 | const variantClasses = { |
| 21 | primary: 'bg-primary text-white hover:bg-primary/90 focus:ring-primary', |
| 22 | secondary: 'bg-secondary text-foreground hover:bg-secondary/80 focus:ring-secondary', |
| 23 | destructive: 'bg-destructive text-white hover:bg-destructive/90 focus:ring-destructive' |
| 24 | }; |
| 25 | |
| 26 | const sizeClasses = { |
| 27 | sm: 'px-3 py-1.5 text-sm', |
| 28 | md: 'px-4 py-2 text-base', |
| 29 | lg: 'px-6 py-3 text-lg' |
| 30 | }; |
| 31 | |
| 32 | return ( |
| 33 | <button |
| 34 | className={clsx( |
| 35 | baseClasses, |
| 36 | variantClasses[variant], |
| 37 | sizeClasses[size], |
| 38 | className |
| 39 | )} |
| 40 | disabled={disabled} |
| 41 | {...props} |
| 42 | > |
| 43 | {children} |
| 44 | </button> |
| 45 | ); |
| 46 | }; |
| 47 | |
| 48 | export default Button; |
nothing calls this directly
no outgoing calls
no test coverage detected