Skip to content

Commit

Permalink
fix(Select): handle long select options
Browse files Browse the repository at this point in the history
  • Loading branch information
zouxuoz committed Jan 28, 2019
1 parent 8b57783 commit 8f458e1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 10 additions & 2 deletions src/components/Select/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ type SelectProps = {|
const customStyles = ({ hasError, zIndex = Z_INDEX.DROPDOWN }) => ({
control: (style, { isFocused }) => ({
...style,
maxHeight: '36px',
minHeight: '36px',
backgroundColor: PALETTE.WHITE,
borderColor: hasError ? PALETTE.DANGER : (isFocused ? PALETTE.PRIMARY : PALETTE.LIGHT_GRAY1),
Expand All @@ -44,7 +43,7 @@ const customStyles = ({ hasError, zIndex = Z_INDEX.DROPDOWN }) => ({
}),
indicatorSeparator: (style) => ({
...style,
backgroundColor: PALETTE.WHITE,
display: 'none',
}),
multiValue: (style) => ({
...style,
Expand All @@ -53,6 +52,7 @@ const customStyles = ({ hasError, zIndex = Z_INDEX.DROPDOWN }) => ({
color: '#878c93',
border: '1px solid #d0d7dd',
backgroundColor: '#fff',
height: 26,
}),
multiValueLabel: (style) => ({
...style,
Expand All @@ -67,6 +67,14 @@ const customStyles = ({ hasError, zIndex = Z_INDEX.DROPDOWN }) => ({
cursor: 'pointer',
},
}),
dropdownIndicator: (style) => ({
...style,
padding: '0 8px',
}),
clearIndicator: (style) => ({
...style,
padding: '0 8px',
}),
});

const Select = ({
Expand Down
14 changes: 14 additions & 0 deletions src/components/Select/Select.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ const OPTIONS = [{
value: 'wiseheartedly',
}];

const LONG_OPTIONS = [{
label: 'Geoglossaceae nontransportation laemodipodiform gluttonously spaework ankylorrhinia zain carlet ironheartedness topia antiorthodox cerebropedal Sothis whispered basilica idealizer outvalue thwacking unafraid coining nak friskily renishly stringsman',
value: 'ovenlike',
}, {
label: 'backhander unpersecuted platch antisymmetrical fumaroid chromitite Microthelyphonida epigraphically myope supramechanical pageant ankle camphory nitronaphthalene thieve umquhile mornings gynomonoecism unvulgarize rickmatic saltless sternoglossal pungi pronumber',
value: 'serjeant',
}, {
label: 'juju tattlery nonperpetual nonexternal vocabularied umber lichenological repressure unpoled blepharosynechia peragration reduplicature acarid citizenism nongelatinizing splenoptosia unpoisoned tympanic tachogram unhardness dovetail transonic cuinage tributariness',
value: 'wiseheartedly',
}];

export default (asStory) => {
asStory('Components/Select', module, (story, { Select, StateContainer, Column, Icon, Row }) => {
story
Expand All @@ -25,6 +36,9 @@ export default (asStory) => {
<StateContainer value={ [OPTIONS[1], OPTIONS[2]] }>
<Select name="name" placeholder="Select an option" options={ OPTIONS } multiple />
</StateContainer>
<StateContainer value={ [LONG_OPTIONS[1], LONG_OPTIONS[2]] }>
<Select name="name" placeholder="Select an option" options={ LONG_OPTIONS } multiple />
</StateContainer>
<StateContainer value={ [OPTIONS[1], OPTIONS[2]] }>
<Select
name="name"
Expand Down

0 comments on commit 8f458e1

Please sign in to comment.