Skip to content

Commit

Permalink
Merge pull request #3540 from risenforces/is-active-example
Browse files Browse the repository at this point in the history
Fix issue with disabled options and add some docs examples for :active
  • Loading branch information
gwyneplaine authored May 6, 2019
2 parents 292bad3 + 52b1ade commit b37edfd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/examples/StyledMulti.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ const colourStyles = {
? chroma.contrast(color, 'white') > 2 ? 'white' : 'black'
: data.color,
cursor: isDisabled ? 'not-allowed' : 'default',

':active': {
...styles[':active'],
backgroundColor: !isDisabled && (isSelected ? data.color : color.alpha(0.3).css()),
},
};
},
multiValue: (styles, { data }) => {
Expand Down
5 changes: 5 additions & 0 deletions docs/examples/StyledSingle.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ const colourStyles = {
? chroma.contrast(color, 'white') > 2 ? 'white' : 'black'
: data.color,
cursor: isDisabled ? 'not-allowed' : 'default',

':active': {
...styles[':active'],
backgroundColor: !isDisabled && (isSelected ? data.color : color.alpha(0.3).css()),
},
};
},
input: styles => ({ ...styles, ...dot() }),
Expand Down
2 changes: 1 addition & 1 deletion src/components/Option.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const optionCSS = ({

// provide some affordance on touch devices
':active': {
backgroundColor: isSelected ? colors.primary : colors.primary50,
backgroundColor: !isDisabled && (isSelected ? colors.primary : colors.primary50),
},
});

Expand Down

0 comments on commit b37edfd

Please sign in to comment.