[ui][typeahead] add label defaultProp

pull/395/head
Jeff Sieu 3 years ago
parent 9b818bc391
commit 40b46a4366

@ -84,7 +84,6 @@ export default function ContributeQuestionForm({
name="company" name="company"
render={({ field }) => ( render={({ field }) => (
<CompaniesTypeahead <CompaniesTypeahead
label="Company"
onSelect={({ id }) => { onSelect={({ id }) => {
field.onChange(id); field.onChange(id);
}} }}

@ -8,9 +8,9 @@ type TypeaheadProps = ComponentProps<typeof Typeahead>;
type Props = Omit< type Props = Omit<
TypeaheadProps, TypeaheadProps,
'noResultsMessage' | 'onQueryChange' | 'options' | 'query' 'label' | 'noResultsMessage' | 'onQueryChange' | 'options' | 'query'
> & > &
Partial<Pick<TypeaheadProps, 'noResultsMessage'>> & Partial<Pick<TypeaheadProps, 'label' | 'noResultsMessage'>> &
( (
| Required<Pick<TypeaheadProps, 'onQueryChange' | 'query'>> | Required<Pick<TypeaheadProps, 'onQueryChange' | 'query'>>
| { | {
@ -39,6 +39,7 @@ export default function CompaniesTypeahead({
return ( return (
<Typeahead <Typeahead
{...typeaheadProps} {...typeaheadProps}
label={typeaheadProps.label ?? 'Company'}
noResultsMessage="No companies found" noResultsMessage="No companies found"
nullable={nullable} nullable={nullable}
options={ options={

@ -22,7 +22,6 @@ export default function HomePage() {
Homepage Homepage
</h1> </h1>
<CompaniesTypeahead <CompaniesTypeahead
label="Company"
onSelect={(option) => setSelectedCompany(option)} onSelect={(option) => setSelectedCompany(option)}
/> />
<pre>{JSON.stringify(selectedCompany, null, 2)}</pre> <pre>{JSON.stringify(selectedCompany, null, 2)}</pre>

@ -46,7 +46,6 @@ export default function OffersHomePage() {
<div className="ml-4"> <div className="ml-4">
<CompaniesTypeahead <CompaniesTypeahead
isLabelHidden={true} isLabelHidden={true}
label="Company"
placeholder="All companies" placeholder="All companies"
onSelect={({ value }) => setCompanyFilter(value)} onSelect={({ value }) => setCompanyFilter(value)}
/> />

Loading…
Cancel
Save