File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ 'use client'
2+ import React from 'react' ;
3+
4+ interface ButtonProps extends React . ButtonHTMLAttributes < HTMLButtonElement > {
5+ variant ?: 'primary' | 'secondary' ;
6+ size ?: 'sm' | 'md' | 'lg' ;
7+ children : React . ReactNode ;
8+ }
9+
10+ const Button : React . FC < ButtonProps > = ( {
11+ variant = 'primary' ,
12+ size = 'md' ,
13+ disabled = false ,
14+ children,
15+ className = '' ,
16+ ...props
17+ } ) => {
18+ const baseStyles = 'font-medium rounded-lg transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed' ;
19+
20+ const variantStyles = {
21+ primary : 'bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500 disabled:hover:bg-blue-600' ,
22+ secondary : 'bg-gray-200 text-gray-900 hover:bg-gray-300 focus:ring-gray-500 disabled:hover:bg-gray-200' ,
23+ } ;
24+
25+ const sizeStyles = {
26+ sm : 'px-3 py-1.5 text-sm' ,
27+ md : 'px-4 py-2 text-base' ,
28+ lg : 'px-6 py-3 text-lg' ,
29+ } ;
30+
31+ const classes = `${ baseStyles } ${ variantStyles [ variant ] } ${ sizeStyles [ size ] } ${ className } ` . trim ( ) ;
32+
33+ return (
34+ < button
35+ className = { classes }
36+ disabled = { disabled }
37+ { ...props }
38+ >
39+ { children }
40+ </ button >
41+ ) ;
42+ } ;
43+
44+ export default Button ;
You can’t perform that action at this time.
0 commit comments