Skip to content

Commit

Permalink
feat(Borrow): cleanup dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip London committed Jan 27, 2020
1 parent 4d2246a commit fc7fe99
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ const SelectInput = props => {
onBlur,
onFocus,
onKeyDown,
openMenuOnClick,
openMenuOnFocus,
searchEnabled,
templateDisplay,
Expand Down Expand Up @@ -225,6 +226,7 @@ const SelectInput = props => {
onChange={handleChange}
onFocus={onFocus}
onKeyDown={onKeyDown}
openMenuOnClick={openMenuOnClick}
openMenuOnFocus={openMenuOnFocus}
options={options}
placeholder={defaultDisplay}
Expand All @@ -236,12 +238,17 @@ const SelectInput = props => {
)
}

SelectInput.defaultProps = {
openMenuOnClick: true
}

SelectInput.propTypes = {
items: PropTypes.array.isRequired,
selected: PropTypes.object,
expanded: PropTypes.bool,
searchEnabled: PropTypes.bool,
menuIsOpen: PropTypes.bool,
openMenuOnClick: PropTypes.bool,
openMenuOnFocus: PropTypes.bool,
disabled: PropTypes.bool,
errorState: PropTypes.string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ export type OwnProps = {
supportedCoins: SupportedCoinsType
}

type SuccessStateType = {
elements: Array<any>
}
type SuccessStateType = Array<AccountTypes>

type LinkStatePropsType = {
data: RemoteDataType<string | Error, SuccessStateType>
Expand All @@ -45,9 +43,6 @@ const AccountContainer = styled.div`
flex-direction: column;
margin-left: 12px;
width: 100%;
> div {
min-height: 0;
}
.bc__single-value {
position: relative;
top: 0;
Expand All @@ -72,7 +67,7 @@ const FiatContainer = styled.div`
export class BorrowCoinDropdown extends Component<Props> {
state = {}

renderElements = values => {
renderElements = (values: SuccessStateType) => {
return [
{
group: '',
Expand All @@ -93,9 +88,7 @@ export class BorrowCoinDropdown extends Component<Props> {
<DisplayContainer>
<Icon size='32px' color={color} name={icon} />
<AccountContainer>
<Text size='16px' weight={500} color='grey800'>
{children}
</Text>
{children}
<AmountContainer>
<CoinDisplay
coin={props.value.coin}
Expand Down Expand Up @@ -134,6 +127,8 @@ export class BorrowCoinDropdown extends Component<Props> {
component={SelectBox}
elements={this.renderElements(values)}
templateDisplay={this.renderDisplay}
hideIndicator={values.length <= 1}
openMenuOnClick={values.length > 1}
searchEnabled={false}
includeAll={false}
name='collateral'
Expand Down

0 comments on commit fc7fe99

Please sign in to comment.