From f470636a70943a8ecad8bddc791a1c2dddd28e1e Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 4 May 2019 21:13:12 +0300 Subject: Components -> UI --- vnext/src/ui/SearchBox.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 vnext/src/ui/SearchBox.js (limited to 'vnext/src/ui/SearchBox.js') diff --git a/vnext/src/ui/SearchBox.js b/vnext/src/ui/SearchBox.js new file mode 100644 index 00000000..a79100cd --- /dev/null +++ b/vnext/src/ui/SearchBox.js @@ -0,0 +1,26 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import ReactRouterPropTypes from 'react-router-prop-types'; +import { withRouter } from 'react-router-dom'; +import { useFormState } from 'react-use-form-state'; + +function SearchBox({ onSearch, history, pathname }) { + let onSubmit = (event) => { + event.preventDefault(); + onSearch(history, pathname, formState.values.search); + }; + const [formState, { text }] = useFormState(); + return ( +
+ +
+ ); +} + +SearchBox.propTypes = { + pathname: PropTypes.string.isRequired, + onSearch: PropTypes.func.isRequired, + history: ReactRouterPropTypes.history.isRequired +}; +export default withRouter(SearchBox); -- cgit v1.2.3