diff options
author | Frankie <frankie.pangilinan@consensys.net> | 2016-07-08 03:07:47 +0800 |
---|---|---|
committer | Frankie <frankie.pangilinan@consensys.net> | 2016-07-08 03:13:38 +0800 |
commit | 0a6560bd5dcadd9dbdb96546b9273be0bb063916 (patch) | |
tree | 9ae105f43b4229489ab3c6948925fa4cdc9892ca /ui/app/components/eth-balance.js | |
parent | bbc7d222d88dd1c0cfe2b534e84592f114670866 (diff) | |
download | tangerine-wallet-browser-0a6560bd5dcadd9dbdb96546b9273be0bb063916.tar tangerine-wallet-browser-0a6560bd5dcadd9dbdb96546b9273be0bb063916.tar.gz tangerine-wallet-browser-0a6560bd5dcadd9dbdb96546b9273be0bb063916.tar.bz2 tangerine-wallet-browser-0a6560bd5dcadd9dbdb96546b9273be0bb063916.tar.lz tangerine-wallet-browser-0a6560bd5dcadd9dbdb96546b9273be0bb063916.tar.xz tangerine-wallet-browser-0a6560bd5dcadd9dbdb96546b9273be0bb063916.tar.zst tangerine-wallet-browser-0a6560bd5dcadd9dbdb96546b9273be0bb063916.zip |
Add method to deal with small decimals and create the object for eth-balance component
Diffstat (limited to 'ui/app/components/eth-balance.js')
-rw-r--r-- | ui/app/components/eth-balance.js | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js index c7240ea21..e68c7b4db 100644 --- a/ui/app/components/eth-balance.js +++ b/ui/app/components/eth-balance.js @@ -2,7 +2,8 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits const formatBalance = require('../util').formatBalance - +const mainBalanceObject = require('../util').mainBalanceObject +const Tooltip = require('./tooltip.js') module.exports = EthBalanceComponent inherits(EthBalanceComponent, Component) @@ -14,7 +15,6 @@ EthBalanceComponent.prototype.render = function () { var state = this.props var style = state.style var value = formatBalance(state.value) - return ( h('.ether-balance', { @@ -30,28 +30,33 @@ EthBalanceComponent.prototype.render = function () { ) } EthBalanceComponent.prototype.renderBalance = function (value) { - if (value === 'None') return value + var balanceObj = mainBalanceObject(value) - var balance = value.split(' ')[0] - var label = value.split(' ')[1] + var balance = balanceObj.balance + var label = balanceObj.label return ( - h('.flex-column', { - style: { - alignItems: 'flex-end', - lineHeight: '13px', - fontFamily: 'Montserrat Thin', - textRendering: 'geometricPrecision', - }, + h(Tooltip, { + position: 'bottom', + title: value.split(' ')[0], }, [ - h('div', balance), - h('div', { + h('.flex-column', { style: { - color: ' #AEAEAE', - fontSize: '12px', + alignItems: 'flex-end', + lineHeight: '13px', + fontFamily: 'Montserrat Light', + textRendering: 'geometricPrecision', }, - }, label), + }, [ + h('div', balance), + h('div', { + style: { + color: ' #AEAEAE', + fontSize: '12px', + }, + }, label), + ]), ]) ) } |