Skip to content

Commit 23663f7

Browse files
committed
fix: hide square behind 'mixed' icon
1 parent c68adc2 commit 23663f7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/components/color-button/color-button.jsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ import styles from './color-button.css';
1010
import GradientTypes from '../../lib/gradient-types';
1111
import log from '../../log/log';
1212

13+
const isMixed = (color, color2, gradientType) => (
14+
color === MIXED || (gradientType !== GradientTypes.SOLID && color2 === MIXED)
15+
);
16+
1317
const colorToBackground = (color, color2, gradientType) => {
14-
if (color === MIXED || (gradientType !== GradientTypes.SOLID && color2 === MIXED)) return 'white';
18+
if (isMixed(color, color2, gradientType)) return 'white';
1519
if (color === null) color = 'white';
1620
if (color2 === null) color2 = 'white';
1721
switch (gradientType) {
@@ -30,7 +34,7 @@ const ColorButtonComponent = props => (
3034
>
3135
<div
3236
className={classNames(styles.colorButtonSwatch, {
33-
[styles.outlineSwatch]: props.outline && !(props.color === MIXED)
37+
[styles.outlineSwatch]: props.outline && !isMixed(props.color, props.color2, props.gradientType)
3438
})}
3539
style={{
3640
background: colorToBackground(props.color, props.color2, props.gradientType)
@@ -42,7 +46,7 @@ const ColorButtonComponent = props => (
4246
draggable={false}
4347
src={noFillIcon}
4448
/>
45-
) : ((props.color === MIXED || (props.gradientType !== GradientTypes.SOLID && props.color2 === MIXED) ? (
49+
) : ((isMixed(props.color, props.color2, props.gradientType) ? (
4650
<img
4751
className={styles.swatchIcon}
4852
draggable={false}

0 commit comments

Comments
 (0)