@@ -53,29 +53,33 @@ export function getButtonStyles(
5353 variant : {
5454 base : [
5555 'group inline-flex gap-x-2 justify-center items-center font-semibold' ,
56- 'text-base/6 text-(--btn-color) sm:text-sm/6 [&>svg[data-ui=icon]:not([class*=size-])]:size-(--icon-size) ' ,
56+ 'text-base/6 text-(--btn-color) sm:text-sm/6' ,
5757 isPressed && 'scale-[0.98]' ,
58- ! isIconOnly && [
59- '[--icon-color:var(--btn-color)]/75'
58+
59+ // icon
60+ [
61+ '[&>svg[data-ui=icon]:not([class*=size-])]:size-(--icon-size)' ,
62+ ! isIconOnly && [ '[--icon-color:var(--btn-color)]/75' ] ,
63+ ! isHovered &&
64+ ! isPressed &&
65+ '[&>svg[data-ui=icon]:not([class*=text-])]:text-(--icon-color)' ,
6066 ] ,
61- ! isHovered &&
62- ! isPressed &&
63- '[&>svg[data-ui=icon]:not([class*=text-])]:text-(--icon-color)' ,
67+
6468 variant === 'solid'
6569 ? [
66- '[--btn-bg:var(--accent)] [--btn-color:lch(from_var(--btn-bg)_calc((49.44_-_l)_*_infinity)_0_0)]' ,
67- color === 'red' &&
68- ' [--btn-bg:var(--color-red-600)] [--btn-color:white]',
69- color === 'green' &&
70- ' [--btn-bg:var(--color-green-600)] [--btn-color:white]',
71- ]
70+ '[--btn-bg:var(--accent)] [--btn-color:lch(from_var(--btn-bg)_calc((49.44_-_l)_*_infinity)_0_0)]' ,
71+ color === 'red' &&
72+ 'outline-(--btn-bg) [--btn-bg:var(--color-red-600)] [--btn-color:white]',
73+ color === 'green' &&
74+ 'outline-(--btn-bg) [--btn-bg:var(--color-green-600)] [--btn-color:white]',
75+ ]
7276 : [
73- '[--btn-color:var(--foreground)]' ,
74- color === 'accent' && '[--btn-color:var(--accent)]' ,
75- color === 'red' &&
76- '[--btn-color:var(--color-red-600)] dark:[--btn-color:var(--color-red-500)]' ,
77- color === 'green' && '[--btn-color:var(--color-green-600)]' ,
78- ] ,
77+ '[--btn-color:var(--foreground)]' ,
78+ color === 'accent' && '[--btn-color:var(--accent)]' ,
79+ color === 'red' &&
80+ '[--btn-color:var(--color-red-600)] dark:[--btn-color:var(--color-red-500)]' ,
81+ color === 'green' && '[--btn-color:var(--color-green-600)]' ,
82+ ] ,
7983 ] ,
8084 solid : [ 'bg-(--btn-bg)' , isHovered && ! isDisabled && 'opacity-85' ] ,
8185 outline : [
@@ -91,24 +95,25 @@ export function getButtonStyles(
9195 } ,
9296 size : {
9397 sm : [
94- // sm:36px
9598 isIconOnly
96- ? 'size-8 sm:size-7 [--icon-size:--spacing(5)] sm:[--icon-size:--spacing(4)]'
99+ ? 'p-1.5 [--icon-size:--spacing(5)] sm:[--icon-size:--spacing(4)]'
97100 : variant !== 'link' &&
98- 'h-8 sm:h-7 [--icon-size:--spacing(3)] text-sm/6 sm:text-xs/6 px-3 ',
101+ 'py-0.5 px-3 text-sm/6 sm:text-xs/6 [--icon-size:--spacing(3.5)] ',
99102 ] ,
100103 md : [
104+ // h: 36px
101105 '[--icon-size:--spacing(5)] sm:[--icon-size:--spacing(4)]' ,
102106 isIconOnly
103107 ? 'p-2.5 sm:p-1.5 [&>svg[data-ui=icon]]:m-0.5 sm:[&>svg[data-ui=icon]]:m-1'
104- : variant !== 'link' && 'px-3.5 py-2.5 sm:py-1.5' ,
108+ : variant !== 'link' && 'px-4 sm:px-3 py-2.5 sm:py-1.5' ,
105109 ] ,
106110 lg : [
107- // lg: 44px,
111+ // h: 44px,
112+ 'gap-x-3' ,
108113 '[--icon-size:--spacing(5)]' ,
109114 isIconOnly
110115 ? 'p-2.5 [&>svg[data-ui=icon]]:m-0.5'
111- : variant !== 'link' && 'px-3.5 py-2.5' ,
116+ : variant !== 'link' && 'px-4 py-2.5' ,
112117 ] ,
113118 } ,
114119 } ;
@@ -119,8 +124,8 @@ export function getButtonStyles(
119124 style . variant [ variant ] ,
120125 style . size [ size ] ,
121126 ! isCustomPending &&
122- isPending &&
123- 'text-transparent [&>svg[data-ui=icon]:not([data-spinner])]:text-transparent' ,
127+ isPending &&
128+ 'text-transparent [&>svg[data-ui=icon]:not([data-spinner])]:text-transparent' ,
124129 className ,
125130 ] ) ;
126131}
@@ -164,4 +169,4 @@ export function getButtonGroupStyles(
164169 } ;
165170
166171 return twMerge ( [ style . base , style [ orientation ] , className ] ) ;
167- }
172+ }
0 commit comments