From 23db6d173786cdeb9564e70549ebcb9596a2ec88 Mon Sep 17 00:00:00 2001 From: Vladimir Volek Date: Fri, 17 Aug 2018 12:32:57 +0200 Subject: [PATCH 1/3] Separate function --- .eslintrc | 1 + .../components/CoinMenu/index.js | 46 +++++++++---------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/.eslintrc b/.eslintrc index 6bc0340c..853370ab 100644 --- a/.eslintrc +++ b/.eslintrc @@ -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, diff --git a/src/js/views/Wallet/components/LeftNavigation/components/CoinMenu/index.js b/src/js/views/Wallet/components/LeftNavigation/components/CoinMenu/index.js index 27b71639..f3a48ce1 100644 --- a/src/js/views/Wallet/components/LeftNavigation/components/CoinMenu/index.js +++ b/src/js/views/Wallet/components/LeftNavigation/components/CoinMenu/index.js @@ -22,33 +22,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 ( - {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 ( - - - - ); - })} + {config.coins.map(item => ( + + + + ))} Date: Fri, 17 Aug 2018 12:35:12 +0200 Subject: [PATCH 2/3] Added wrapper --- .../LeftNavigation/components/CoinMenu/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/js/views/Wallet/components/LeftNavigation/components/CoinMenu/index.js b/src/js/views/Wallet/components/LeftNavigation/components/CoinMenu/index.js index f3a48ce1..207ecb52 100644 --- a/src/js/views/Wallet/components/LeftNavigation/components/CoinMenu/index.js +++ b/src/js/views/Wallet/components/LeftNavigation/components/CoinMenu/index.js @@ -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; @@ -35,7 +37,7 @@ class CoinMenu extends Component { render() { const { config } = this.props.localStorage; return ( - + {config.coins.map(item => ( ))} - + ); } } From 8c4d68f49c6cb9eb2b7f0d9076ea7188e42bf6de Mon Sep 17 00:00:00 2001 From: Vladimir Volek Date: Fri, 17 Aug 2018 12:39:15 +0200 Subject: [PATCH 3/3] Indent small enhancements --- .../LeftNavigation/components/Row/index.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/js/views/Wallet/components/LeftNavigation/components/Row/index.js b/src/js/views/Wallet/components/LeftNavigation/components/Row/index.js index 5a8598f8..c0f27b06 100644 --- a/src/js/views/Wallet/components/LeftNavigation/components/Row/index.js +++ b/src/js/views/Wallet/components/LeftNavigation/components/Row/index.js @@ -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, -}) => ( - {children} +const Row = ({ children, column = false }) => ( + + {children} );