@@ -2,53 +2,68 @@ import { useNavigate } from 'react-router-dom';
22import { tv } from 'tailwind-variants/lite' ;
33
44const buttonVariants = tv ( {
5- // base styles for all buttons
6- base : 'font-poppins flex items-center justify-center drop-shadow-[0_4px_4px_rgba(0,0,0,0.25)]' ,
7- // all button variants
8- variants : {
9- size : {
10- sm : 'h-12 w-[162px] text-base font-semibold rounded-lg lg:h-14 lg:w-[220px] lg:text-xl' ,
11- md : 'h-11 w-[218px] text-base font-semibold rounded-lg lg:h-14 lg:w-[286px] lg:text-xl xl:h-16 xl:w-[327px] xl:text-2xl' ,
12- lg : 'h-11 w-[345px] text-base font-medium rounded-md lg:w-[501px]' ,
13- circ : 'h-11 w-11 text-2xl rounded-full'
14- } ,
15- color : {
16- primary : 'bg-eerie text-white border-1 border-eerie' ,
17- secondary : 'bg-white text-eerie border-1 border-eerie' ,
18- gradient : 'bg-gradient-to-b from-electricgreen to-persianblue text-white'
19- }
5+ // base styles for all buttons
6+ base : 'font-poppins flex items-center justify-center drop-shadow-[0_4px_4px_rgba(0,0,0,0.25)]' ,
7+ // all button variants
8+ variants : {
9+ size : {
10+ sm : 'h-12 w-[162px] text-base font-semibold rounded-lg lg:h-14 lg:w-[220px] lg:text-xl' ,
11+ md : 'h-11 w-[218px] text-base font-semibold rounded-lg lg:h-14 lg:w-[286px] lg:text-xl xl:h-16 xl:w-[327px] xl:text-2xl' ,
12+ lg : 'h-11 w-[345px] text-base font-medium rounded-md lg:w-[501px]' ,
13+ circ : 'h-11 w-11 text-2xl rounded-full' ,
2014 } ,
21- // default button styles if no specified props
22- defaultVariants : {
23- size : 'sm ' ,
24- color : 'primary'
15+ color : {
16+ primary : 'bg-eerie text-white border-1 border-eerie' ,
17+ secondary : 'bg-white text-eerie border-1 border-eerie ' ,
18+ gradient : 'bg-gradient-to-b from-electricgreen to-persianblue text-white' ,
2519 } ,
26- // conditional style cases for specific prop combinations
27- compoundVariants : [
28- // remove drop shadow and lower font weight for user selection button
29- {
30- color : 'secondary' ,
31- size : 'md' ,
32- className : 'drop-shadow-none !font-normal'
33- }
34- ]
20+ } ,
21+ // default button styles if no specified props
22+ defaultVariants : {
23+ size : 'sm' ,
24+ color : 'primary' ,
25+ } ,
26+ // conditional style cases for specific prop combinations
27+ compoundVariants : [
28+ // remove drop shadow and lower font weight for user selection button
29+ {
30+ color : 'secondary' ,
31+ size : 'md' ,
32+ className : 'drop-shadow-none !font-normal' ,
33+ } ,
34+ ] ,
3535} ) ;
3636
37- export default function Button ( { size, color, label, onClick, isActive, to, ...props } ) {
38- let navigate = useNavigate ( ) ;
37+ export default function Button ( {
38+ size,
39+ color,
40+ label,
41+ onClick,
42+ isActive,
43+ to,
44+ ...props
45+ } ) {
46+ let navigate = useNavigate ( ) ;
3947
40- function handleClick ( ) {
41- if ( to ) {
42- navigate ( to ) ;
43- } else {
44- onClick ( ) ;
45- }
48+ function handleClick ( ) {
49+ if ( to ) {
50+ navigate ( to ) ;
51+ } else {
52+ onClick ( ) ;
4653 }
54+ }
4755
48- return (
49- < button onClick = { handleClick } className = { isActive ? `${ buttonVariants ( { size, color } ) } active` : buttonVariants ( { size, color } ) }
50- { ...props }
51- > { label }
52- </ button >
53- ) ;
54- }
56+ return (
57+ < button
58+ onClick = { handleClick }
59+ className = {
60+ isActive
61+ ? `${ buttonVariants ( { size, color } ) } active`
62+ : buttonVariants ( { size, color } )
63+ }
64+ { ...props }
65+ >
66+ { label }
67+ </ button >
68+ ) ;
69+ }
0 commit comments