diff options
Using eth balance component to ensure proper rounding.
Diffstat (limited to 'ui/app/components')
-rw-r--r-- | ui/app/components/eth-balance.js | 69 | ||||
-rw-r--r-- | ui/app/components/tooltip.js | 2 |
2 files changed, 43 insertions, 28 deletions
diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js index 4f538fd31..32ff4efdf 100644 --- a/ui/app/components/eth-balance.js +++ b/ui/app/components/eth-balance.js @@ -37,7 +37,17 @@ EthBalanceComponent.prototype.render = function () { } EthBalanceComponent.prototype.renderBalance = function (value) { var props = this.props - const { conversionRate, shorten, incoming, currentCurrency } = props + const { + conversionRate, + shorten, + incoming, + currentCurrency, + hideTooltip, + styleOveride, + } = props + + const { fontSize, color, fontFamily, lineHeight } = styleOveride + if (value === 'None') return value if (value === '...') return value var balanceObj = generateBalanceObject(value, shorten ? 1 : 3) @@ -54,36 +64,41 @@ EthBalanceComponent.prototype.renderBalance = function (value) { } var label = balanceObj.label + const tooltipProps = hideTooltip ? {} : { + position: 'bottom', + title: `${ethNumber} ${ethSuffix}`, + }; return ( - h(Tooltip, { - position: 'bottom', - title: `${ethNumber} ${ethSuffix}`, - }, h('div.flex-column', [ - h('.flex-row', { - style: { - alignItems: 'flex-end', - lineHeight: '13px', - fontFamily: 'Montserrat Light', - textRendering: 'geometricPrecision', - }, - }, [ - h('div', { - style: { - width: '100%', - textAlign: 'right', - }, - }, incoming ? `+${balance}` : balance), - h('div', { + h(hideTooltip ? 'div' : Tooltip, + tooltipProps, + h('div.flex-column', [ + h('.flex-row', { style: { - color: ' #AEAEAE', - fontSize: '12px', - marginLeft: '5px', + alignItems: 'flex-end', + lineHeight: lineHeight || '13px', + fontFamily: fontFamily || 'Montserrat Light', + textRendering: 'geometricPrecision', }, - }, label), - ]), + }, [ + h('div', { + style: { + width: '100%', + textAlign: 'right', + fontSize: fontSize || 'inherit', + color: color || 'inherit', + }, + }, incoming ? `+${balance}` : balance), + h('div', { + style: { + color: color || '#AEAEAE', + fontSize: fontSize || '12px', + marginLeft: '5px', + }, + }, label), + ]), - showFiat ? h(FiatValue, { value: props.value, conversionRate, currentCurrency }) : null, - ])) + showFiat ? h(FiatValue, { value: props.value, conversionRate, currentCurrency }) : null, + ])) ) } diff --git a/ui/app/components/tooltip.js b/ui/app/components/tooltip.js index edbc074bb..74cf1ae43 100644 --- a/ui/app/components/tooltip.js +++ b/ui/app/components/tooltip.js @@ -12,7 +12,7 @@ function Tooltip () { Tooltip.prototype.render = function () { const props = this.props - const { position, title, children } = props + const { position, title, children, show = true } = props return h(ReactTooltip, { position: position || 'left', |