blob: 629b7b1d0797b1eea9cdba9e8dd4bb1a1c94769a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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.strip().length > 1) {
this.props.actions.search(this.props.payload, value.strip())
}
}
render() {
return (
<div className='query'>
<h2>Search by Name</h2>
<h3>Searching {13456} identities</h3>
<p>
{'Enter your name to see if you were included in this dataset..'}
</p>
<input
type="text"
className="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)
|