Skip to content

Commit

Permalink
fix(SelectBoxCoin): add icons
Browse files Browse the repository at this point in the history
  • Loading branch information
plondon committed May 15, 2018
1 parent 148dd02 commit 0b8b1a7
Showing 1 changed file with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,39 @@
import React from 'react'
import { connect } from 'react-redux'

import styled from 'styled-components'
import SelectBox from '../SelectBox'
import { Icon, Text } from 'blockchain-info-components'
import { prop } from 'ramda'

const HeaderWrapper = styled.div`
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
width: 100%;
height: 100%;
padding: 5px;
box-sizing: border-box;
text-overflow: ellipsis;
& > * { margin-left: 5px; }
& > :first-child { margin-right: 5px; }
`

const renderItem = (item) => (<HeaderWrapper>
{prop('value', item) === 'BTC' && <Icon name='bitcoin-in-circle' size='14px' weight={300} />}
{prop('value', item) === 'BCH' && <Icon name='bitcoin-cash' size='14px' weight={300} />}
{prop('value', item) === 'ETH' && <Icon name='ethereum-filled' size='14px' weight={300} />}
<Text size='13px' weight={300} cursor='pointer'>
{item.text}
</Text>
</HeaderWrapper>)

class SelectBoxCoin extends React.PureComponent {
render () {
const { coins, ...rest } = this.props
const elements = [{ group: '', items: coins }]
return <SelectBox elements={elements} {...rest} />
return <SelectBox elements={elements} templateDisplay={renderItem} templateItem={renderItem} {...rest} />
}
}

Expand Down

0 comments on commit 0b8b1a7

Please sign in to comment.