|
|
|
@ -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 generateBalanceObject = require('../util').generateBalanceObject |
|
|
|
|
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 = generateBalanceObject(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), |
|
|
|
|
]), |
|
|
|
|
]) |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|