aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/components/SearchBox.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-06-24 18:25:55 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:53 +0300
commitd68bc6e975aa549840cea4904fafe11f78ad3b3c (patch)
tree8e8733912d05e4b273e8c43b8a3c68aa796b6f5a /vnext/src/components/SearchBox.js
parent660cc823d4f2446dbc3113b2de4d3164664303fb (diff)
SearchBox component
Diffstat (limited to 'vnext/src/components/SearchBox.js')
-rw-r--r--vnext/src/components/SearchBox.js30
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
+}