mirror of
https://github.com/vercel/commerce.git
synced 2025-07-25 11:11:24 +00:00
Better support for swatches
This commit is contained in:
@@ -31,3 +31,7 @@
|
||||
@apply border-accents-9 border-2;
|
||||
}
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
@apply w-auto px-4;
|
||||
}
|
||||
|
@@ -37,7 +37,9 @@ const Swatch: FC<Omit<ButtonProps, 'variant'> & Props> = ({
|
||||
|
||||
return (
|
||||
<Button
|
||||
className={rootClassName}
|
||||
className={cn(rootClassName, {
|
||||
[s.wrapper]: !color,
|
||||
})}
|
||||
style={color ? { backgroundColor: color } : {}}
|
||||
aria-label="Variant Swatch"
|
||||
{...props}
|
||||
@@ -47,7 +49,7 @@ const Swatch: FC<Omit<ButtonProps, 'variant'> & Props> = ({
|
||||
<Check />
|
||||
</span>
|
||||
)}
|
||||
{variant === 'size' ? label : null}
|
||||
{variant !== 'color' ? label : null}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user