diff options
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 } |