|
@ -14,8 +14,7 @@ import Search from 'components/base/Search' |
|
|
import Text from 'components/base/Text' |
|
|
import Text from 'components/base/Text' |
|
|
|
|
|
|
|
|
import IconCheck from 'icons/Check' |
|
|
import IconCheck from 'icons/Check' |
|
|
|
|
|
import IconAngleDown from 'icons/AngleDown' |
|
|
import Triangles from './Triangles' |
|
|
|
|
|
|
|
|
|
|
|
type Props = { |
|
|
type Props = { |
|
|
fuseOptions?: Object, |
|
|
fuseOptions?: Object, |
|
@ -37,10 +36,11 @@ const Container = styled(Box).attrs({ relative: true, color: 'graphite' })`` |
|
|
|
|
|
|
|
|
const TriggerBtn = styled(Box).attrs({ |
|
|
const TriggerBtn = styled(Box).attrs({ |
|
|
ff: 'Open Sans|SemiBold', |
|
|
ff: 'Open Sans|SemiBold', |
|
|
p: 4, |
|
|
fontSize: 4, |
|
|
|
|
|
pl: 3, |
|
|
pr: 5, |
|
|
pr: 5, |
|
|
})` |
|
|
})` |
|
|
min-height: 64px; |
|
|
height: 40px; |
|
|
${space}; |
|
|
${space}; |
|
|
border: 1px solid ${p => p.theme.colors.fog}; |
|
|
border: 1px solid ${p => p.theme.colors.fog}; |
|
|
border-radius: 3px; |
|
|
border-radius: 3px; |
|
@ -62,12 +62,6 @@ const Item = styled(Box).attrs({ |
|
|
background: ${p => (p.highlighted ? p.theme.colors.lightGrey : p.theme.colors.white)}; |
|
|
background: ${p => (p.highlighted ? p.theme.colors.lightGrey : p.theme.colors.white)}; |
|
|
` |
|
|
` |
|
|
|
|
|
|
|
|
const ItemWrapper = styled(Box)` |
|
|
|
|
|
& + & { |
|
|
|
|
|
border-top: 1px solid ${p => p.theme.colors.fog}; |
|
|
|
|
|
} |
|
|
|
|
|
` |
|
|
|
|
|
|
|
|
|
|
|
const Dropdown = styled(Box).attrs({ |
|
|
const Dropdown = styled(Box).attrs({ |
|
|
mt: 1, |
|
|
mt: 1, |
|
|
})` |
|
|
})` |
|
@ -81,7 +75,7 @@ const Dropdown = styled(Box).attrs({ |
|
|
z-index: 1; |
|
|
z-index: 1; |
|
|
` |
|
|
` |
|
|
|
|
|
|
|
|
const FloatingTriangles = styled(Box).attrs({ |
|
|
const FloatingDown = styled(Box).attrs({ |
|
|
alignItems: 'center', |
|
|
alignItems: 'center', |
|
|
justifyContent: 'center', |
|
|
justifyContent: 'center', |
|
|
mr: 2, |
|
|
mr: 2, |
|
@ -90,6 +84,7 @@ const FloatingTriangles = styled(Box).attrs({ |
|
|
top: 0; |
|
|
top: 0; |
|
|
right: 0; |
|
|
right: 0; |
|
|
bottom: 0; |
|
|
bottom: 0; |
|
|
|
|
|
color: ${p => p.theme.colors.grey}; |
|
|
|
|
|
|
|
|
// to "simulate" border to make arrows appears at the exact same place as
|
|
|
// to "simulate" border to make arrows appears at the exact same place as
|
|
|
// the no-input version
|
|
|
// the no-input version
|
|
@ -97,15 +92,12 @@ const FloatingTriangles = styled(Box).attrs({ |
|
|
` |
|
|
` |
|
|
|
|
|
|
|
|
const IconSelected = styled(Box).attrs({ |
|
|
const IconSelected = styled(Box).attrs({ |
|
|
bg: 'wallet', |
|
|
color: 'wallet', |
|
|
color: 'white', |
|
|
|
|
|
alignItems: 'center', |
|
|
alignItems: 'center', |
|
|
justifyContent: 'center', |
|
|
justifyContent: 'center', |
|
|
})` |
|
|
})` |
|
|
border-radius: 50%; |
|
|
height: 12px; |
|
|
height: 15px; |
|
|
width: 12px; |
|
|
font-size: 5px; |
|
|
|
|
|
width: 15px; |
|
|
|
|
|
opacity: ${p => (p.selected ? 1 : 0)}; |
|
|
opacity: ${p => (p.selected ? 1 : 0)}; |
|
|
` |
|
|
` |
|
|
|
|
|
|
|
@ -156,7 +148,7 @@ class Select extends PureComponent<Props> { |
|
|
}} |
|
|
}} |
|
|
> |
|
|
> |
|
|
{items.map((item, i) => ( |
|
|
{items.map((item, i) => ( |
|
|
<ItemWrapper |
|
|
<Box |
|
|
key={keyProp ? item[keyProp] : item.key} |
|
|
key={keyProp ? item[keyProp] : item.key} |
|
|
innerRef={n => (this._children[i] = n)} |
|
|
innerRef={n => (this._children[i] = n)} |
|
|
{...getItemProps({ item })} |
|
|
{...getItemProps({ item })} |
|
@ -171,17 +163,17 @@ class Select extends PureComponent<Props> { |
|
|
</Box> |
|
|
</Box> |
|
|
<Box> |
|
|
<Box> |
|
|
<IconSelected selected={selectedItem === item}> |
|
|
<IconSelected selected={selectedItem === item}> |
|
|
<IconCheck height={7} width={7} /> |
|
|
<IconCheck height={12} width={12} /> |
|
|
</IconSelected> |
|
|
</IconSelected> |
|
|
</Box> |
|
|
</Box> |
|
|
</Item> |
|
|
</Item> |
|
|
</ItemWrapper> |
|
|
</Box> |
|
|
))} |
|
|
))} |
|
|
</GrowScroll> |
|
|
</GrowScroll> |
|
|
) : ( |
|
|
) : ( |
|
|
<ItemWrapper> |
|
|
<Box> |
|
|
<Item>{'No results'}</Item> |
|
|
<Item>{'No results'}</Item> |
|
|
</ItemWrapper> |
|
|
</Box> |
|
|
)} |
|
|
)} |
|
|
</Dropdown> |
|
|
</Dropdown> |
|
|
) |
|
|
) |
|
@ -231,9 +223,9 @@ class Select extends PureComponent<Props> { |
|
|
{searchable ? ( |
|
|
{searchable ? ( |
|
|
<Box relative> |
|
|
<Box relative> |
|
|
<Input keepEvent {...getInputProps({ placeholder })} onClick={openMenu} /> |
|
|
<Input keepEvent {...getInputProps({ placeholder })} onClick={openMenu} /> |
|
|
<FloatingTriangles> |
|
|
<FloatingDown> |
|
|
<Triangles /> |
|
|
<IconAngleDown width={10} height={10} /> |
|
|
</FloatingTriangles> |
|
|
</FloatingDown> |
|
|
</Box> |
|
|
</Box> |
|
|
) : ( |
|
|
) : ( |
|
|
<TriggerBtn |
|
|
<TriggerBtn |
|
@ -250,9 +242,9 @@ class Select extends PureComponent<Props> { |
|
|
<Text color="fog">{placeholder}</Text> |
|
|
<Text color="fog">{placeholder}</Text> |
|
|
)} |
|
|
)} |
|
|
</Box> |
|
|
</Box> |
|
|
<FloatingTriangles> |
|
|
<FloatingDown> |
|
|
<Triangles /> |
|
|
<IconAngleDown width={10} height={10} /> |
|
|
</FloatingTriangles> |
|
|
</FloatingDown> |
|
|
</TriggerBtn> |
|
|
</TriggerBtn> |
|
|
)} |
|
|
)} |
|
|
{isOpen && |
|
|
{isOpen && |
|
|