diff options
author | Chi Kei Chan <chikeichan@gmail.com> | 2017-09-12 13:14:09 +0800 |
---|---|---|
committer | Chi Kei Chan <chikeichan@gmail.com> | 2017-09-12 13:14:09 +0800 |
commit | 062e67bff83fd79647231be6e2448d35b5f312f9 (patch) | |
tree | a624e670971853b4288eb2b622021423b37f65d5 /ui/app/components/send/currency-toggle.js | |
parent | 392d0d020c4a6efea7e0207dd0a6a70d13766241 (diff) | |
download | tangerine-wallet-browser-062e67bff83fd79647231be6e2448d35b5f312f9.tar tangerine-wallet-browser-062e67bff83fd79647231be6e2448d35b5f312f9.tar.gz tangerine-wallet-browser-062e67bff83fd79647231be6e2448d35b5f312f9.tar.bz2 tangerine-wallet-browser-062e67bff83fd79647231be6e2448d35b5f312f9.tar.lz tangerine-wallet-browser-062e67bff83fd79647231be6e2448d35b5f312f9.tar.xz tangerine-wallet-browser-062e67bff83fd79647231be6e2448d35b5f312f9.tar.zst tangerine-wallet-browser-062e67bff83fd79647231be6e2448d35b5f312f9.zip |
Add buttons; handle back; add yarn.lock
Diffstat (limited to 'ui/app/components/send/currency-toggle.js')
-rw-r--r-- | ui/app/components/send/currency-toggle.js | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/ui/app/components/send/currency-toggle.js b/ui/app/components/send/currency-toggle.js index d3c2222a4..adaade301 100644 --- a/ui/app/components/send/currency-toggle.js +++ b/ui/app/components/send/currency-toggle.js @@ -1,6 +1,8 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits +const classnames = require('classnames') + module.exports = CurrencyToggle inherits(CurrencyToggle, Component) @@ -8,18 +10,25 @@ function CurrencyToggle () { Component.call(this) } +const defaultCurrencies = [ 'ETH', 'USD' ] + CurrencyToggle.prototype.render = function () { const { onClick, currentCurrency } = this.props + const [currencyA, currencyB] = this.props.currencies || defaultCurrencies - return h('span', {}, [ + return h('span.currency-toggle', {}, [ h('span', { - className: currentCurrency === 'ETH' ? 'selected-currency' : 'unselected-currency', - onClick: () => onClick('ETH'), + className: classnames('currency-toggle__item', { + 'currency-toggle__item--selected': currencyA === currentCurrency, + }), + onClick: () => onClick(currencyA), }, ['ETH']), '<>', h('span', { - className: currentCurrency === 'USD' ? 'selected-currency' : 'unselected-currency', - onClick: () => onClick('USD'), + className: classnames('currency-toggle__item', { + 'currency-toggle__item--selected': currencyB === currentCurrency, + }), + onClick: () => onClick(currencyB), }, ['USD']), ]) // holding on icon from design } |