1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-12-26 00:48:35 +00:00

Separate function

This commit is contained in:
Vladimir Volek 2018-08-17 12:32:57 +02:00
parent 27e3385b7d
commit 23db6d1737
2 changed files with 24 additions and 23 deletions

View File

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

View File

@ -22,33 +22,33 @@ class CoinMenu extends Component {
return baseUrl; 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() { render() {
const { config } = this.props.localStorage; const { config } = this.props.localStorage;
return ( return (
<React.Fragment> <React.Fragment>
{config.coins.map((item) => { {config.coins.map(item => (
let imgName = item.network; <NavLink
if (item.network === 'ethereum') { key={item.network}
imgName = 'eth'; to={`${this.getBaseUrl()}/network/${item.network}/account/0`}
} else if (item.network === 'ethereum-classic') { >
imgName = 'etc'; <RowCoin
} coin={{
const imgUrl = `../images/${imgName}-logo.png`; img: this.getImgUrl(item.network),
name: item.name,
return ( }}
<NavLink />
key={item.network} </NavLink>
to={`${this.getBaseUrl()}/network/${item.network}/account/0`} ))}
>
<RowCoin
coin={{
img: imgUrl,
name: item.name,
}}
/>
</NavLink>
);
})}
<Divider <Divider
textLeft="Other coins" textLeft="Other coins"
textRight="(You will be redirected)" textRight="(You will be redirected)"