summaryrefslogtreecommitdiff
path: root/client/nameSearch/nameSearch.query.js
diff options
context:
space:
mode:
authorAdam Harvey <adam@ahprojects.com>2018-12-23 01:37:03 +0100
committerAdam Harvey <adam@ahprojects.com>2018-12-23 01:37:03 +0100
commit4452e02e8b04f3476273574a875bb60cfbb4568b (patch)
tree3ffa44f9621b736250a8b94da14a187dc785c2fe /client/nameSearch/nameSearch.query.js
parent2a65f7a157bd4bace970cef73529867b0e0a374d (diff)
parent5340bee951c18910fd764241945f1f136b5a22b4 (diff)
.
Diffstat (limited to 'client/nameSearch/nameSearch.query.js')
-rw-r--r--client/nameSearch/nameSearch.query.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/client/nameSearch/nameSearch.query.js b/client/nameSearch/nameSearch.query.js
new file mode 100644
index 00000000..b82e324b
--- /dev/null
+++ b/client/nameSearch/nameSearch.query.js
@@ -0,0 +1,48 @@
+import React, { Component } from 'react'
+import { bindActionCreators } from 'redux'
+import { connect } from 'react-redux'
+
+import * as actions from './nameSearch.actions'
+
+class NameSearchQuery extends Component {
+ state = {
+ value: null
+ }
+
+ handleInput(value) {
+ this.setState({ q: value })
+ if (value.length > 2) {
+ this.props.actions.search(this.props.payload, value)
+ }
+ }
+
+ render() {
+ return (
+ <div className='query'>
+ <h2>Find Your Name</h2>
+ <h3>Searching {13456} identities</h3>
+ <p>
+ {'Enter your name to see if you were included in this dataset..'}
+ </p>
+ <input
+ type="text"
+ class="q"
+ placeholder="Enter your name"
+ value={this.state.q}
+ onInput={e => this.handleInput(e.target.value)}
+ />
+ </div>
+ )
+ }
+}
+
+const mapStateToProps = state => ({
+ result: state.nameSearch.result,
+ options: state.nameSearch.options,
+})
+
+const mapDispatchToProps = dispatch => ({
+ actions: bindActionCreators({ ...actions }, dispatch),
+})
+
+export default connect(mapStateToProps, mapDispatchToProps)(NameSearchQuery)