Separate function

pull/3/head
Vladimir Volek 6 years ago
parent 27e3385b7d
commit 23db6d1737

@ -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,

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

Loading…
Cancel
Save