♻️ refactor: put the icon size to icon theme
This commit is contained in:
parent
022ffbe589
commit
33cd907455
@ -55,8 +55,7 @@ const SegmentedControlItem = forwardRef<
|
||||
},
|
||||
ref,
|
||||
) => {
|
||||
const iconSize = size === 'sm' ? 16 : 20;
|
||||
const { item } = segmentedControlsTheme({ size, type });
|
||||
const { item, icon } = segmentedControlsTheme({ size, type });
|
||||
|
||||
return (
|
||||
<button
|
||||
@ -65,10 +64,9 @@ const SegmentedControlItem = forwardRef<
|
||||
className={item({ className })}
|
||||
data-active={active}
|
||||
>
|
||||
{leftIcon && cloneIcon(leftIcon, { width: iconSize, height: iconSize })}
|
||||
{leftIcon && cloneIcon(leftIcon, { className: icon({ size }) })}
|
||||
{children}
|
||||
{rightIcon &&
|
||||
cloneIcon(rightIcon, { width: iconSize, height: iconSize })}
|
||||
{rightIcon && cloneIcon(rightIcon, { className: icon({ size }) })}
|
||||
</button>
|
||||
);
|
||||
},
|
||||
|
@ -38,14 +38,17 @@ export const segmentedControlsTheme = tv({
|
||||
'data-[active=true]:shadow-field',
|
||||
'data-[active=true]:hover:bg-controls-tertiary-hovered',
|
||||
],
|
||||
icon: [],
|
||||
},
|
||||
variants: {
|
||||
size: {
|
||||
sm: {
|
||||
item: ['px-3', 'py-2', 'text-xs'],
|
||||
icon: ['h-4', 'w-4'],
|
||||
},
|
||||
md: {
|
||||
item: ['px-4', 'py-3', 'text-sm', 'tracking-[-0.006em]'],
|
||||
icon: ['h-5', 'w-5'],
|
||||
},
|
||||
},
|
||||
type: {
|
||||
|
Loading…
Reference in New Issue
Block a user