diff options
| author | adamhrv <adam@ahprojects.com> | 2018-12-18 01:15:48 +0100 |
|---|---|---|
| committer | adamhrv <adam@ahprojects.com> | 2018-12-18 01:15:48 +0100 |
| commit | 162246a0f1931428c85ab9a31ba42de9ef34dae3 (patch) | |
| tree | a7a80b9836025400269fcb7623a934deb37bbc39 /client/nameSearch/nameSearch.query.js | |
| parent | 994d74feae29f2577bc04e10dd4bafbfb3dc8e83 (diff) | |
| parent | bf3dd1399e4ef1db5fb8830004827fe603f73b2e (diff) | |
Merge branch 'master' of github.com:adamhrv/megapixels_dev
Diffstat (limited to 'client/nameSearch/nameSearch.query.js')
| -rw-r--r-- | client/nameSearch/nameSearch.query.js | 48 |
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) |
