Skip to content

Commit

Permalink
Merge pull request #6203 from Armanio/fix/knob_color
Browse files Browse the repository at this point in the history
fix(knobs): color type button z-index
  • Loading branch information
shilman authored Mar 20, 2019
2 parents 7c0fa86 + c3ca208 commit 033757e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions addons/knobs/src/components/types/Color.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const Swatch = styled.div(({ theme }) => ({
borderRadius: '1rem',
}));

const ColorButton = styled(Button)(({ active }) => ({
zIndex: active ? 3 : 'unset',
}));

const Popover = styled.div({
position: 'absolute',
zIndex: '2',
Expand Down Expand Up @@ -80,7 +84,13 @@ class ColorType extends React.Component {
};

return (
<Button type="button" name={knob.name} onClick={this.handleClick} size="flex">
<ColorButton
active={displayColorPicker}
type="button"
name={knob.name}
onClick={this.handleClick}
size="flex"
>
{knob.value.toUpperCase()}
<Swatch style={colorStyle} />
{displayColorPicker ? (
Expand All @@ -92,7 +102,7 @@ class ColorType extends React.Component {
<SketchPicker color={knob.value} onChange={this.handleChange} />
</Popover>
) : null}
</Button>
</ColorButton>
);
}
}
Expand Down

0 comments on commit 033757e

Please sign in to comment.