Skip to content

Commit

Permalink
fix(Dropdown): Adjust disabled opacity
Browse files Browse the repository at this point in the history
  • Loading branch information
thyhjwb6 committed Jul 13, 2022
1 parent 32ff6cf commit 1c00d88
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,28 @@ const StyledWrapper = styled.div`
height: 15rem;
`

export const Default: ComponentStory<typeof Dropdown> = (props) => {
const Template: ComponentStory<typeof Dropdown> = (props) => {
return (
<StyledWrapper>
<Dropdown {...props} />
</StyledWrapper>
)
}

export const Default = Template.bind({})
Default.args = {
options,
label: 'Example label',
}

export const Open = Template.bind({})
Open.storyName = 'Open'
Open.args = {
options,
initialIsOpen: true,
label: 'Example label',
}

const iconOptions = options.map((option) => ({
...option,
icon: <IconAnchor />,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import { DropdownPlaceholder } from './DropdownPlaceholder'
const { color, shadow, spacing } = selectors

export interface DropdownProps {
/**
* Toggles whether the list is open on first render.
*/
initialIsOpen?: boolean
/**
* Handler called when an option is clicked.
*/
Expand Down Expand Up @@ -138,6 +142,7 @@ const StyledSelect = styled(Select)`
`

export const Dropdown: React.FC<DropdownProps> = ({
initialIsOpen,
onSelect,
options,
label,
Expand All @@ -154,6 +159,7 @@ export const Dropdown: React.FC<DropdownProps> = ({
classNamePrefix="rn-dropdown"
components={{ DropdownIndicator, Placeholder: DropdownPlaceholder }}
controlShouldRenderValue={false}
defaultMenuIsOpen={initialIsOpen}
formatOptionLabel={DropdownLabel}
isSearchable={false}
options={options}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const StyledLabel = styled.div<StyledLabelProps>`
${({ isDisabled }) =>
isDisabled &&
css`
opacity: 0.25;
cursor: not-allowed;
opacity: 0.7;
`}
`

0 comments on commit 1c00d88

Please sign in to comment.