1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 09:18:09 +00:00

Merge branch 'styled-components-refactor' of https://github.com/satoshilabs/trezor-wallet into styled-components-refactor

This commit is contained in:
Vasek Mlejnsky 2018-08-17 12:56:48 +02:00
commit a2c0c92446
3 changed files with 35 additions and 36 deletions

View File

@ -9,6 +9,7 @@
"jest": true
},
"rules": {
"class-methods-use-this": 0,
"react/require-default-props": 0,
"react/forbid-prop-types": 0,
"react/destructuring-assignment": 0,

View File

@ -1,4 +1,4 @@
/* @flow */
import styled from 'styled-components';
import coins from 'constants/coins';
import colors from 'config/colors';
import ICONS from 'config/icons';
@ -8,6 +8,8 @@ import { NavLink } from 'react-router-dom';
import Divider from '../Divider';
import RowCoin from '../RowCoin';
const Wrapper = styled.div``;
class CoinMenu extends Component {
getBaseUrl() {
const { selectedDevice } = this.props.wallet;
@ -22,33 +24,33 @@ class CoinMenu extends Component {
return baseUrl;
}
getImgUrl(network) {
let imgName = network;
if (network === 'ethereum') {
imgName = 'eth';
} else if (network === 'ethereum-classic') {
imgName = 'etc';
}
return `../images/${imgName}-logo.png`;
}
render() {
const { config } = this.props.localStorage;
return (
<React.Fragment>
{config.coins.map((item) => {
let imgName = item.network;
if (item.network === 'ethereum') {
imgName = 'eth';
} else if (item.network === 'ethereum-classic') {
imgName = 'etc';
}
const imgUrl = `../images/${imgName}-logo.png`;
return (
<NavLink
key={item.network}
to={`${this.getBaseUrl()}/network/${item.network}/account/0`}
>
<RowCoin
coin={{
img: imgUrl,
name: item.name,
}}
/>
</NavLink>
);
})}
<Wrapper>
{config.coins.map(item => (
<NavLink
key={item.network}
to={`${this.getBaseUrl()}/network/${item.network}/account/0`}
>
<RowCoin
coin={{
img: this.getImgUrl(item.network),
name: item.name,
}}
/>
</NavLink>
))}
<Divider
textLeft="Other coins"
textRight="(You will be redirected)"
@ -70,7 +72,7 @@ class CoinMenu extends Component {
/>
</a>
))}
</React.Fragment>
</Wrapper>
);
}
}

View File

@ -6,26 +6,22 @@ import { TRANSITION_TIME } from 'config/variables';
const Wrapper = styled.div`
height: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
cursor: pointer;
transition: background-color ${TRANSITION_TIME.BASE}, color ${TRANSITION_TIME.BASE};
${props => props.column && css`
flex-direction: column;
align-items: flex-start;
`}
cursor: pointer;
transition: background-color ${TRANSITION_TIME.BASE}, color ${TRANSITION_TIME.BASE};
`;
const Row = ({
children, column = false,
}) => (
<Wrapper
column={column}
>{children}
const Row = ({ children, column = false }) => (
<Wrapper column={column}>
{children}
</Wrapper>
);