diff options
Diffstat (limited to 'vnext/src/components')
-rw-r--r-- | vnext/src/components/SearchBox.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/vnext/src/components/SearchBox.js b/vnext/src/components/SearchBox.js new file mode 100644 index 00000000..38414c78 --- /dev/null +++ b/vnext/src/components/SearchBox.js @@ -0,0 +1,30 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +export default class SearchBox extends React.Component { + constructor(props) { + super(props) + this.state = { + search: '' + } + } + handleChange = (event) => { + this.setState({ + search: event.target.value + }) + } + onSubmit = (event) => { + event.preventDefault() + this.props.onSearch(this.state.search); + } + render() { + return <form onSubmit={this.onSubmit}> + <input name="search" className="text" + placeholder="Search..." value={this.state.search} onChange={this.handleChange} /> + </form> + } +} + +SearchBox.propTypes = { + onSearch: PropTypes.func.isRequired +} |