[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"
render={({ field }) => (
<CompaniesTypeahead
label="Company"
onSelect={({ id }) => {
field.onChange(id);
}}

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

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

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

Loading…
Cancel
Save