docbrown/app/javascript/Search/SearchForm.jsx
Nick Taylor 8fabccec4e
Add Preact dev tools to development bundles (#11459)
* Now Preact dev tools are injected into development bundles.

* Updated frontend debugging documentation.

* Updated frontend debugging documentation wording.
2020-11-18 14:20:58 +01:00

36 lines
804 B
JavaScript

import PropTypes from 'prop-types';
import { h } from 'preact';
export const SearchForm = ({
searchTerm,
onSearch,
onSubmitSearch,
searchBoxId,
}) => (
<form
action="/search"
acceptCharset="UTF-8"
method="get"
onSubmit={onSubmitSearch}
>
<input name="utf8" type="hidden" value="✓" />
<input
className="crayons-header--search-input crayons-textfield"
type="text"
name="q"
id={searchBoxId}
placeholder="Search..."
autoComplete="off"
aria-label="search"
onKeyDown={onSearch}
value={searchTerm}
/>
</form>
);
SearchForm.propTypes = {
searchTerm: PropTypes.string.isRequired,
searchBoxId: PropTypes.string.isRequired,
onSearch: PropTypes.func.isRequired,
onSubmitSearch: PropTypes.func.isRequired,
};