|
|
@ -2,7 +2,8 @@ const Component = require('react').Component |
|
|
|
const h = require('react-hyperscript') |
|
|
|
const h = require('react-hyperscript') |
|
|
|
const inherits = require('util').inherits |
|
|
|
const inherits = require('util').inherits |
|
|
|
const formatBalance = require('../util').formatBalance |
|
|
|
const formatBalance = require('../util').formatBalance |
|
|
|
|
|
|
|
const generateBalanceObject = require('../util').generateBalanceObject |
|
|
|
|
|
|
|
const Tooltip = require('./tooltip.js') |
|
|
|
module.exports = EthBalanceComponent |
|
|
|
module.exports = EthBalanceComponent |
|
|
|
|
|
|
|
|
|
|
|
inherits(EthBalanceComponent, Component) |
|
|
|
inherits(EthBalanceComponent, Component) |
|
|
@ -14,7 +15,6 @@ EthBalanceComponent.prototype.render = function () { |
|
|
|
var state = this.props |
|
|
|
var state = this.props |
|
|
|
var style = state.style |
|
|
|
var style = state.style |
|
|
|
var value = formatBalance(state.value) |
|
|
|
var value = formatBalance(state.value) |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
|
|
|
|
|
|
|
|
h('.ether-balance', { |
|
|
|
h('.ether-balance', { |
|
|
@ -30,18 +30,22 @@ EthBalanceComponent.prototype.render = function () { |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
EthBalanceComponent.prototype.renderBalance = function (value) { |
|
|
|
EthBalanceComponent.prototype.renderBalance = function (value) { |
|
|
|
|
|
|
|
|
|
|
|
if (value === 'None') return value |
|
|
|
if (value === 'None') return value |
|
|
|
|
|
|
|
var balanceObj = generateBalanceObject(value) |
|
|
|
|
|
|
|
|
|
|
|
var balance = value.split(' ')[0] |
|
|
|
var balance = balanceObj.balance |
|
|
|
var label = value.split(' ')[1] |
|
|
|
var label = balanceObj.label |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
|
|
|
|
h(Tooltip, { |
|
|
|
|
|
|
|
position: 'bottom', |
|
|
|
|
|
|
|
title: value.split(' ')[0], |
|
|
|
|
|
|
|
}, [ |
|
|
|
h('.flex-column', { |
|
|
|
h('.flex-column', { |
|
|
|
style: { |
|
|
|
style: { |
|
|
|
alignItems: 'flex-end', |
|
|
|
alignItems: 'flex-end', |
|
|
|
lineHeight: '13px', |
|
|
|
lineHeight: '13px', |
|
|
|
fontFamily: 'Montserrat Thin', |
|
|
|
fontFamily: 'Montserrat Light', |
|
|
|
textRendering: 'geometricPrecision', |
|
|
|
textRendering: 'geometricPrecision', |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, [ |
|
|
|
}, [ |
|
|
@ -52,6 +56,7 @@ EthBalanceComponent.prototype.renderBalance = function (value) { |
|
|
|
fontSize: '12px', |
|
|
|
fontSize: '12px', |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, label), |
|
|
|
}, label), |
|
|
|
|
|
|
|
]), |
|
|
|
]) |
|
|
|
]) |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|