Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 3x 3x 3x 3x 24x 21x 21x 10x 1x 24x | import React, { Dispatch } from 'react';
import {
Button,
Form,
useFormContext,
useI18nContext,
} from '@procore/core-react';
import { CompanyNameField } from './CompanyNameField';
import { PCNSearchHeader } from '../PCNSearchHeader';
export function SearchButton() {
const i18n = useI18nContext();
const { values } = useFormContext<{ company: string }>();
return (
<Button
type="submit"
data-pendo="new-add-company-search-button"
disabled={!values.company}
>
{i18n.t('views.generic.directory.add_company_package.search')}
</Button>
);
}
export interface PCNSearchFormProps {
searchFormData: { company: string };
setSearchFormData: Dispatch<
React.SetStateAction<{
company: string;
}>
>;
}
export function PCNSearchForm(props: PCNSearchFormProps) {
return (
<Form
onSubmit={(values) => {
props.setSearchFormData(values);
}}
initialValues={props.searchFormData}
>
<PCNSearchHeader />
<Form.Form>
<Form.Row>
<CompanyNameField />
<Form.Field
as={() => <SearchButton />}
colStart={11}
colWidth={2}
name="button"
/>
</Form.Row>
</Form.Form>
</Form>
);
}
|