aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send/currency-toggle.js
diff options
context:
space:
mode:
authorLe Quoc Viet <vietlq85@gmail.com>2018-03-15 16:11:42 +0800
committerGitHub <noreply@github.com>2018-03-15 16:11:42 +0800
commit04079455e36e48433cf8055c8f1f79e1e7e18298 (patch)
treed7de2a6603b67b56abacf09bee4d2bbbfe886b8f /ui/app/components/send/currency-toggle.js
parent5bdee96e73f65a0b369277e9c56b0afe5159e65b (diff)
parente2efc91aee64072c408ab509219dcbfb389c7609 (diff)
downloadtangerine-wallet-browser-04079455e36e48433cf8055c8f1f79e1e7e18298.tar
tangerine-wallet-browser-04079455e36e48433cf8055c8f1f79e1e7e18298.tar.gz
tangerine-wallet-browser-04079455e36e48433cf8055c8f1f79e1e7e18298.tar.bz2
tangerine-wallet-browser-04079455e36e48433cf8055c8f1f79e1e7e18298.tar.lz
tangerine-wallet-browser-04079455e36e48433cf8055c8f1f79e1e7e18298.tar.xz
tangerine-wallet-browser-04079455e36e48433cf8055c8f1f79e1e7e18298.tar.zst
tangerine-wallet-browser-04079455e36e48433cf8055c8f1f79e1e7e18298.zip
Merge pull request #1 from MetaMask/master
Merge from the source
Diffstat (limited to 'ui/app/components/send/currency-toggle.js')
-rw-r--r--ui/app/components/send/currency-toggle.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/ui/app/components/send/currency-toggle.js b/ui/app/components/send/currency-toggle.js
new file mode 100644
index 000000000..7aaccd490
--- /dev/null
+++ b/ui/app/components/send/currency-toggle.js
@@ -0,0 +1,44 @@
+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)
+function CurrencyToggle () {
+ Component.call(this)
+}
+
+const defaultCurrencies = [ 'ETH', 'USD' ]
+
+CurrencyToggle.prototype.renderToggles = function () {
+ const { onClick, activeCurrency } = this.props
+ const [currencyA, currencyB] = this.props.currencies || defaultCurrencies
+
+ return [
+ h('span', {
+ className: classnames('currency-toggle__item', {
+ 'currency-toggle__item--selected': currencyA === activeCurrency,
+ }),
+ onClick: () => onClick(currencyA),
+ }, [ currencyA ]),
+ '<>',
+ h('span', {
+ className: classnames('currency-toggle__item', {
+ 'currency-toggle__item--selected': currencyB === activeCurrency,
+ }),
+ onClick: () => onClick(currencyB),
+ }, [ currencyB ]),
+ ]
+}
+
+CurrencyToggle.prototype.render = function () {
+ const currencies = this.props.currencies || defaultCurrencies
+
+ return h('span.currency-toggle', currencies.length
+ ? this.renderToggles()
+ : []
+ )
+}
+