aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/components/SearchBox.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-07-18 13:24:00 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:53 +0300
commitab09cb3b3aed7105570c387d9c4ff18e7f5c544c (patch)
tree016781d623804e04ba79a1ba21ffe0d8c596fee3 /vnext/src/components/SearchBox.js
parentd0053977cd080814747a221a5531fe6a726c2834 (diff)
SearchBox now works
Diffstat (limited to 'vnext/src/components/SearchBox.js')
-rw-r--r--vnext/src/components/SearchBox.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/vnext/src/components/SearchBox.js b/vnext/src/components/SearchBox.js
index e64c8be4..314b89fb 100644
--- a/vnext/src/components/SearchBox.js
+++ b/vnext/src/components/SearchBox.js
@@ -1,7 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
+import ReactRouterPropTypes from 'react-router-prop-types';
+import { withRouter } from 'react-router-dom';
-export default class SearchBox extends React.Component {
+class SearchBox extends React.Component {
constructor(props) {
super(props);
this.state = {
@@ -14,8 +16,9 @@ export default class SearchBox extends React.Component {
});
}
onSubmit = (event) => {
+ const { history, pathname } = this.props;
event.preventDefault();
- this.props.onSearch(this.state.search);
+ this.props.onSearch(history, pathname, this.state.search);
this.setState({
search: ''
});
@@ -29,5 +32,8 @@ export default class SearchBox extends React.Component {
}
SearchBox.propTypes = {
- onSearch: PropTypes.func.isRequired
+ pathname: PropTypes.string.isRequired,
+ onSearch: PropTypes.func.isRequired,
+ history: ReactRouterPropTypes.history.isRequired
};
+export default withRouter(SearchBox);