diff options
author | Dan <danjm.com@gmail.com> | 2017-08-29 01:39:05 +0800 |
---|---|---|
committer | Dan <danjm.com@gmail.com> | 2017-08-29 22:56:31 +0800 |
commit | 43ceeacf0f0cc46a60a01fff9d94672fad5383b5 (patch) | |
tree | cc54e2164b3ff787535d34241543315b9f2420d1 /ui/app/send.js | |
parent | 0a44c824586f74a770c1e6c618e62279b5dc773b (diff) | |
download | tangerine-wallet-browser-43ceeacf0f0cc46a60a01fff9d94672fad5383b5.tar.gz tangerine-wallet-browser-43ceeacf0f0cc46a60a01fff9d94672fad5383b5.tar.zst tangerine-wallet-browser-43ceeacf0f0cc46a60a01fff9d94672fad5383b5.zip |
Refactor for clean handling of tooltip close.
Diffstat (limited to 'ui/app/send.js')
-rw-r--r-- | ui/app/send.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/ui/app/send.js b/ui/app/send.js index e3a48a441..73d5616a1 100644 --- a/ui/app/send.js +++ b/ui/app/send.js @@ -267,18 +267,17 @@ SendTransactionScreen.prototype.render = function () { }) : h('div', {}, [`${this.state.newTx.gasFee} ETH`]), h('div.send-screen-gas-input-customize', { - onClick: () => this.setTooltipOpen.bind(this)(!this.state.tooltipIsOpen), + onClick: () => this.toggleTooltip.bind(this)(!this.state.tooltipIsOpen), }, [ 'Customize' ]), ]), - h(GasTooltip, { - isOpen: this.state.tooltipIsOpen, + this.state.tooltipIsOpen && h(GasTooltip, { className: 'send-tooltip', gasPrice: parseInt(this.state.newTx.gasPrice, 16), gasLimit: parseInt(this.state.newTx.gas, 16), - onClickOutside: () => this.setTooltipOpen.bind(this)(false), + onClose: this.closeTooltip.bind(this), onFeeChange: ({gasLimit, gasPrice}) => { this.setState({ newTx: Object.assign( @@ -585,8 +584,12 @@ SendTransactionScreen.prototype.renderSendToken = function () { ) } -SendTransactionScreen.prototype.setTooltipOpen = function (isOpen) { - this.setState({ tooltipIsOpen: isOpen }) +SendTransactionScreen.prototype.toggleTooltip = function () { + this.setState({ tooltipIsOpen: !this.state.tooltipIsOpen }) +} + +SendTransactionScreen.prototype.closeTooltip = function () { + this.setState({ tooltipIsOpen: false }) } SendTransactionScreen.prototype.setCurrentCurrency = function (newCurrency) { |