Update Swatch.tsx

This commit is contained in:
cond0r 2021-05-28 16:47:02 +03:00
parent df4f2e90c9
commit 1bfa0119b5

View File

@ -44,14 +44,15 @@ const Swatch: FC<Omit<ButtonProps, 'variant'> & SwatchProps> = ({
className={swatchClassName}
style={color ? { backgroundColor: color } : {}}
aria-label="Variant Swatch"
{...(label && color && { title: label })}
{...props}
>
{variant === 'color' && active && (
{variant === 'color' && color && active && (
<span>
<Check />
</span>
)}
{variant !== 'color' ? label : null}
{variant !== 'color' || !color ? label : null}
</Button>
)
}