diff options
author | Dan <danjm.com@gmail.com> | 2018-04-11 22:21:54 +0800 |
---|---|---|
committer | Dan <danjm.com@gmail.com> | 2018-04-11 22:21:54 +0800 |
commit | 59c887301aba5d746d669441ec78ef7ec5de3146 (patch) | |
tree | 3236b2e9acbcf45358ecaaf0e291a1a9505729b1 /ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.component.js | |
parent | f4d8da927734b2dcd597d1cc833f9fe6ac59cc77 (diff) | |
download | tangerine-wallet-browser-59c887301aba5d746d669441ec78ef7ec5de3146.tar.gz tangerine-wallet-browser-59c887301aba5d746d669441ec78ef7ec5de3146.tar.zst tangerine-wallet-browser-59c887301aba5d746d669441ec78ef7ec5de3146.zip |
second commit
Diffstat (limited to 'ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.component.js')
-rw-r--r-- | ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.component.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.component.js b/ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.component.js index e69de29bb..59a1fd6db 100644 --- a/ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.component.js +++ b/ui/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.component.js @@ -0,0 +1,54 @@ +import React, { Component } from 'react' +import PropTypes from 'prop-types' + +export default class AmountMaxButton extends Component { + + static propTypes = { + tokenBalance: PropTypes.string, + gasTotal: PropTypes.string, + balance: PropTypes.string, + selectedToken: PropTypes.object, + setAmountToMax: PropTypes.func, + setMaxModeTo: PropTypes.func, + maxModeOn: PropTypes.bool, + }; + + setAmountToMax = function () { + const { + balance, + tokenBalance, + selectedToken, + gasTotal, + setAmountToMax, + } = this.props + + setAmountToMax({ + tokenBalance, + selectedToken, + gasTotal, + setAmountToMax, + }) + } + + render () { + const { setMaxModeTo } = this.props + + return ( + <div + className='send-v2__amount-max' + onClick={(event) => { + event.preventDefault() + setMaxModeTo(true) + this.setAmountToMax() + }} + > + {!maxModeOn ? this.context.t('max') : '' ])} + </div> + ); + } + +} + +AmountMaxButton.contextTypes = { + t: PropTypes.func, +} |