diff options
author | Chi Kei Chan <chikeichan@gmail.com> | 2017-09-22 09:44:52 +0800 |
---|---|---|
committer | Chi Kei Chan <chikeichan@gmail.com> | 2017-09-22 09:44:52 +0800 |
commit | 3ec2f534632426876c28b22c58cbbf14b4904d97 (patch) | |
tree | ed84f2703e86a29a7db43a4ecabac308a0cbe7bb /ui/app/components/token-balance.js | |
parent | 24fd16b1bee31352ef7f364804eb5f06c08c3bf6 (diff) | |
download | tangerine-wallet-browser-3ec2f534632426876c28b22c58cbbf14b4904d97.tar tangerine-wallet-browser-3ec2f534632426876c28b22c58cbbf14b4904d97.tar.gz tangerine-wallet-browser-3ec2f534632426876c28b22c58cbbf14b4904d97.tar.bz2 tangerine-wallet-browser-3ec2f534632426876c28b22c58cbbf14b4904d97.tar.lz tangerine-wallet-browser-3ec2f534632426876c28b22c58cbbf14b4904d97.tar.xz tangerine-wallet-browser-3ec2f534632426876c28b22c58cbbf14b4904d97.tar.zst tangerine-wallet-browser-3ec2f534632426876c28b22c58cbbf14b4904d97.zip |
Integrate Add Token
Diffstat (limited to 'ui/app/components/token-balance.js')
-rw-r--r-- | ui/app/components/token-balance.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ui/app/components/token-balance.js b/ui/app/components/token-balance.js index 3a923eb9d..0342c1da9 100644 --- a/ui/app/components/token-balance.js +++ b/ui/app/components/token-balance.js @@ -17,7 +17,8 @@ module.exports = connect(mapStateToProps)(TokenBalance) inherits(TokenBalance, Component) function TokenBalance () { this.state = { - balance: '', + string: '', + symbol: '', isLoading: true, error: null, } @@ -26,11 +27,14 @@ function TokenBalance () { TokenBalance.prototype.render = function () { const state = this.state - const { balance, isLoading } = state + const { symbol, string, balanceOnly, isLoading } = state return isLoading ? h('span', '') - : h('span', balance) + : h('span.token-balance', [ + h('span.token-balance__amount', string), + !balanceOnly && h('span.token-balance__symbol', symbol), + ]) } TokenBalance.prototype.componentDidMount = function () { @@ -93,10 +97,10 @@ TokenBalance.prototype.componentDidUpdate = function (nextProps) { TokenBalance.prototype.updateBalance = function (tokens = []) { const [{ string, symbol }] = tokens - const { balanceOnly } = this.props this.setState({ - balance: balanceOnly ? string : `${string} ${symbol}`, + string, + symbol, isLoading: false, }) } |