* init * whoops * components update * components update * classes * variables * focus * test * spec * test * adjust colors and variables * buttons colors * Update app/javascript/crayons/CTAs/CTA.jsx Co-authored-by: Suzanne Aitchison <suzanne@forem.com> * proptype * remove duplicated tests now in Cypress, enhance Cypress nav menu tests * premove unneeded viewport in test * remove focus check for now * classnames * Update app/javascript/crayons/CTAs/__stories__/CTAs.mdx Co-authored-by: Nick Taylor <nick@iamdeveloper.com> * Update app/javascript/crayons/CTAs/__stories__/CTAs.mdx Co-authored-by: Nick Taylor <nick@iamdeveloper.com> * better contrast * classname * radius-full Co-authored-by: Suzanne Aitchison <suzanne@forem.com> Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
import PropTypes from 'prop-types';
|
|
import { h } from 'preact';
|
|
import { forwardRef } from 'preact/compat';
|
|
import { locale } from '../utilities/locale';
|
|
import { ButtonNew as Button } from '@crayons';
|
|
import SearchIcon from '@images/search.svg';
|
|
|
|
export const SearchForm = forwardRef(({ searchTerm, onSubmitSearch }, ref) => (
|
|
<form
|
|
action="/search"
|
|
acceptCharset="UTF-8"
|
|
method="get"
|
|
onSubmit={onSubmitSearch}
|
|
role="search"
|
|
>
|
|
<input name="utf8" type="hidden" value="✓" />
|
|
<div class="crayons-fields crayons-fields--horizontal">
|
|
<div class="crayons-field flex-1 relative">
|
|
<input
|
|
ref={ref}
|
|
className="crayons-header--search-input crayons-textfield"
|
|
type="text"
|
|
name="q"
|
|
placeholder={`${locale('core.search')}...`}
|
|
autoComplete="off"
|
|
aria-label="Search term"
|
|
value={searchTerm}
|
|
/>
|
|
<Button
|
|
type="submit"
|
|
icon={SearchIcon}
|
|
className="absolute inset-px left-auto mt-0 py-0"
|
|
aria-label="Search"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
));
|
|
|
|
SearchForm.propTypes = {
|
|
searchTerm: PropTypes.string.isRequired,
|
|
onSubmitSearch: PropTypes.func.isRequired,
|
|
};
|