Skip to content

Commit

Permalink
feat(Borrow): dropdown cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip London committed Jan 29, 2020
1 parent 5ff69cf commit a18cc6a
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ const StyledCreatableSelect = styled(CreatableSelect)`
font-size: ${props => (props.fontSize === 'small' ? '14px' : '16px')};
.bc__menu {
border-radius: 4px;
box-shadow: initial;
border: 1px solid ${props => props.theme.grey100};
background-color: ${props => props.theme.white};
}
.bc__menu-list {
border-radius: 4px;
padding: 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ const StyledSelect = styled(Select)`
font-size: ${props => (props.fontSize === 'small' ? '14px' : '16px')};
.bc__menu {
border-radius: 4px;
box-shadow: initial;
border: 1px solid ${props => props.theme.grey100};
background-color: ${props => props.theme.white};
}
.bc__menu-list {
border-radius: 4px;
padding: 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`FormItem renders correctly 1`] = `
<label
className="c0"
htmlFor="comp"
>
<text
color="gray-6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import {
AccountTypes,
CoinType,
RemoteDataType,
SupportedCoinsType
SupportedCoinsType,
SupportedCoinType
} from 'core/types'
import { connect } from 'react-redux'
import { Field } from 'redux-form'
import { getData } from './selectors'
import { Icon, Text } from 'blockchain-info-components'
import { RatesType } from 'data/types'
import { RootState } from 'data/rootReducer'

import CoinDisplay from 'components/Display/CoinDisplay'
import FiatDisplay from 'components/Display/FiatDisplay'
import React, { Component } from 'react'
Expand All @@ -30,11 +32,18 @@ type LinkStatePropsType = {

type Props = OwnProps & LinkStatePropsType

const DisplayContainer = styled.div`
const DisplayContainer = styled.div<{
coinType: SupportedCoinType
isItem: boolean
}>`
display: flex;
padding: 16px 12px;
width: 100%;
align-items: center;
box-sizing: border-box;
padding: ${props => (props.isItem ? '6px 6px 0px 6px' : '16px 12px')};
> span {
color: ${props => props.theme[props.coinType.colorCode]} !important;
}
`

const AccountContainer = styled.div`
Expand All @@ -43,6 +52,7 @@ const AccountContainer = styled.div`
flex-direction: column;
margin-left: 12px;
width: 100%;
cursor: pointer;
.bc__single-value {
position: relative;
top: 0;
Expand Down Expand Up @@ -83,17 +93,19 @@ export class BorrowCoinDropdown extends Component<Props> {
const coinType = this.props.supportedCoins[props.value.coin]
const icon = coinType.icons.circleFilled
const color = coinType.colorCode
const isItem = !children

return (
<DisplayContainer>
<DisplayContainer coinType={coinType} isItem={isItem}>
<Icon size='32px' color={color} name={icon} />
<AccountContainer>
{children}
{children || props.value.label}
<AmountContainer>
<CoinDisplay
coin={props.value.coin}
size='12px'
weight={500}
cursor='pointer'
color='grey800'
>
{props.value.balance}
Expand All @@ -107,6 +119,7 @@ export class BorrowCoinDropdown extends Component<Props> {
weight={500}
color='grey400'
currency='USD'
cursor='pointer'
rates={this.props.rates}
>
{props.value.balance}
Expand All @@ -127,10 +140,10 @@ export class BorrowCoinDropdown extends Component<Props> {
component={SelectBox}
elements={this.renderElements(values)}
templateDisplay={this.renderDisplay}
templateItem={this.renderDisplay}
hideIndicator={values.length <= 1}
openMenuOnClick={values.length > 1}
searchEnabled={false}
includeAll={false}
name='collateral'
/>
)
Expand Down
56 changes: 29 additions & 27 deletions packages/blockchain-wallet-v4/src/redux/walletOptions/types.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
import { CoinType } from '../../types'

export type SupportedCoinsType = {
[key in CoinType]: {
availability: {
exchangeFrom: boolean
exchangeTo: boolean
lockbox: boolean
request: boolean
send: boolean
syncToPit: boolean
}
coinCode: string
coinTicker: string
colorCode: string
config: {
network: string
}
displayName: string
hasLockboxSupport: boolean
icons: {
circle: string
circleFilled: string
default: string
}
learnMoreLink: string
minConfirmations: number
txExplorerBaseUrl: string
txListAppRoute: string
export type SupportedCoinType = {
availability: {
exchangeFrom: boolean
exchangeTo: boolean
lockbox: boolean
request: boolean
send: boolean
syncToPit: boolean
}
coinCode: string
coinTicker: string
colorCode: string
config: {
network: string
}
displayName: string
hasLockboxSupport: boolean
icons: {
circle: string
circleFilled: string
default: string
}
learnMoreLink: string
minConfirmations: number
txExplorerBaseUrl: string
txListAppRoute: string
}

export type SupportedCoinsType = {
[key in CoinType]: SupportedCoinType
}

0 comments on commit a18cc6a

Please sign in to comment.