diff options
author | Vitaly Takmazov | 2018-06-24 18:25:55 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:53 +0300 |
commit | d68bc6e975aa549840cea4904fafe11f78ad3b3c (patch) | |
tree | 8e8733912d05e4b273e8c43b8a3c68aa796b6f5a /vnext/src/components | |
parent | 660cc823d4f2446dbc3113b2de4d3164664303fb (diff) |
SearchBox component
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 +} |