Skip to content

Commit

Permalink
refactor conditional styling
Browse files Browse the repository at this point in the history
  • Loading branch information
sakibh committed Jul 11, 2022
1 parent 6dacfb6 commit 0f39146
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion protocol-designer/src/components/ColorPicker/ColorPicker.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
cursor: pointer;
}

.swatch:hover {
.swatch:hover,
.swatch_enabled {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.41);
}

Expand Down
8 changes: 4 additions & 4 deletions protocol-designer/src/components/ColorPicker/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react'
import cx from 'classnames'
import { ColorResult, TwitterPicker } from 'react-color'
import { COLORS } from '@opentrons/components'

Expand All @@ -15,10 +16,9 @@ export function ColorPicker(props: ColorPickerProps): JSX.Element {
return (
<div>
<div
className={styles.swatch}
style={
showColorPicker ? { boxShadow: '0 2px 4px rgba(0, 0, 0, 0.41)' } : {}
}
className={cx(styles.swatch, {
[styles.swatch_enabled]: showColorPicker,
})}
onClick={() => setShowColorPicker(showColorPicker => !showColorPicker)}
>
<div
Expand Down

0 comments on commit 0f39146

Please sign in to comment.