docbrown/app/javascript/Search/SearchForm.jsx
ludwiczakpawel 9d384e1a93
CSS Cleanups, part 2 (#10527)
* padding-top on body

* padding-top on body

* move cheese around

* .

* :(

* rename
2020-10-03 06:57:57 +02:00

37 lines
830 B
JavaScript

import 'preact/devtools';
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,
};