mirror of https://github.com/trezor/trezor-wallet
- 'RowCoin' is used in both 'AccountMenu' and 'CoinMenu'pull/3/head
parent
8b511e7f0b
commit
27e3385b7d
@ -0,0 +1,35 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import React from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import { ICON_SIZE } from 'config/variables';
|
||||||
|
|
||||||
|
const CoinNameWrapper = styled.div`
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const Logo = styled.div`
|
||||||
|
height: ${ICON_SIZE.BASE};
|
||||||
|
width: ${ICON_SIZE.BASE};
|
||||||
|
margin-right: 5px;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center;
|
||||||
|
background-size: auto ${ICON_SIZE.BASE};
|
||||||
|
background-image: url('${props => props.coinImg}');
|
||||||
|
`;
|
||||||
|
|
||||||
|
const CoinName = ({
|
||||||
|
coinImg, text,
|
||||||
|
}) => (
|
||||||
|
<CoinNameWrapper>
|
||||||
|
{coinImg && <Logo coinImg={coinImg} />}
|
||||||
|
<p>{text}</p>
|
||||||
|
</CoinNameWrapper>
|
||||||
|
);
|
||||||
|
CoinName.propTypes = {
|
||||||
|
coinImg: PropTypes.string,
|
||||||
|
text: PropTypes.string.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CoinName;
|
@ -0,0 +1,76 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import Icon from 'components/Icon';
|
||||||
|
import { FONT_SIZE } from 'config/variables';
|
||||||
|
import colors from 'config/colors';
|
||||||
|
import Row from '../Row';
|
||||||
|
import CoinName from './components/CoinName';
|
||||||
|
|
||||||
|
const RowCoinWrapper = styled.div`
|
||||||
|
padding: 16px 24px;
|
||||||
|
height: 50px;
|
||||||
|
display: block;
|
||||||
|
font-size: ${FONT_SIZE.BASE};
|
||||||
|
color: ${colors.TEXT_PRIMARY};
|
||||||
|
&:hover {
|
||||||
|
background-color: ${colors.GRAY_LIGHT};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const Left = styled.div`
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const IconWrapper = styled.div`
|
||||||
|
margin-right: 10px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const RowCoin = ({
|
||||||
|
coin, iconLeft, iconRight,
|
||||||
|
}) => (
|
||||||
|
<RowCoinWrapper>
|
||||||
|
<Row>
|
||||||
|
<Left>
|
||||||
|
{iconLeft && (
|
||||||
|
<IconWrapper>
|
||||||
|
<Icon
|
||||||
|
icon={iconLeft.type}
|
||||||
|
size={iconLeft.size}
|
||||||
|
color={iconLeft.color}
|
||||||
|
/>
|
||||||
|
</IconWrapper>
|
||||||
|
)}
|
||||||
|
<CoinName
|
||||||
|
coinImg={coin.img}
|
||||||
|
text={coin.name}
|
||||||
|
/>
|
||||||
|
</Left>
|
||||||
|
{iconRight && (
|
||||||
|
<Icon
|
||||||
|
icon={iconRight.type}
|
||||||
|
size={iconRight.size}
|
||||||
|
color={iconRight.color}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Row>
|
||||||
|
</RowCoinWrapper>
|
||||||
|
);
|
||||||
|
|
||||||
|
const iconShape = {
|
||||||
|
type: PropTypes.string.isRequired,
|
||||||
|
color: PropTypes.string.isRequired,
|
||||||
|
size: PropTypes.number.isRequired,
|
||||||
|
};
|
||||||
|
RowCoin.propTypes = {
|
||||||
|
coin: PropTypes.shape({
|
||||||
|
img: PropTypes.string.isRequired,
|
||||||
|
name: PropTypes.string.isRequired,
|
||||||
|
}).isRequired,
|
||||||
|
iconLeft: PropTypes.shape(iconShape),
|
||||||
|
iconRight: PropTypes.shape(iconShape),
|
||||||
|
};
|
||||||
|
|
||||||
|
export default RowCoin;
|
Loading…
Reference in new issue