aboutsummaryrefslogtreecommitdiffstats
path: root/development/selector.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-07-01 12:22:39 +0800
committerDan Finlay <dan@danfinlay.com>2016-07-01 12:22:39 +0800
commitd33d4f065492d32df35c8eb72a7c51b74bf4b155 (patch)
tree8f7788329475f00dedf2039364862a6bd4fe298b /development/selector.js
parentaa21c83470d2fa89a5dc09a49c7ab83cf4e87ad7 (diff)
parentd4e400e5e5a7ba501f210b722f6ccf97be9e6c17 (diff)
downloadtangerine-wallet-browser-d33d4f065492d32df35c8eb72a7c51b74bf4b155.tar
tangerine-wallet-browser-d33d4f065492d32df35c8eb72a7c51b74bf4b155.tar.gz
tangerine-wallet-browser-d33d4f065492d32df35c8eb72a7c51b74bf4b155.tar.bz2
tangerine-wallet-browser-d33d4f065492d32df35c8eb72a7c51b74bf4b155.tar.lz
tangerine-wallet-browser-d33d4f065492d32df35c8eb72a7c51b74bf4b155.tar.xz
tangerine-wallet-browser-d33d4f065492d32df35c8eb72a7c51b74bf4b155.tar.zst
tangerine-wallet-browser-d33d4f065492d32df35c8eb72a7c51b74bf4b155.zip
Merge branch 'master' into FrankieDisclaimer
Diffstat (limited to 'development/selector.js')
-rw-r--r--development/selector.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/development/selector.js b/development/selector.js
new file mode 100644
index 000000000..b58904cdf
--- /dev/null
+++ b/development/selector.js
@@ -0,0 +1,30 @@
+const Component = require('react').Component
+const h = require('react-hyperscript')
+const inherits = require('util').inherits
+
+module.exports = NewComponent
+
+inherits(NewComponent, Component)
+function NewComponent () {
+ Component.call(this)
+}
+
+NewComponent.prototype.render = function () {
+ const props = this.props
+ let { states, selectedKey, actions, store } = props
+
+ const state = this.state || {}
+ const selected = state.selected || selectedKey
+
+ return h('select', {
+ value: selected,
+ onChange:(event) => {
+ const selectedKey = event.target.value
+ store.dispatch(actions.update(selectedKey))
+ this.setState({ selected: selectedKey })
+ },
+ }, Object.keys(states).map((stateName) => {
+ return h('option', { value: stateName }, stateName)
+ }))
+
+}