[ui][companies typeahead] Add isLabelHidden and placeHolder props (#361)

* [ui][companies typeahead] add isLabelHidden and placeHolder props

* [ui][companies typeahead] add isLabelHidden and placeHolder props
This commit is contained in:
Ai Ling
2022-10-11 19:53:21 +08:00
committed by GitHub
parent 73e1f76570
commit 325a2d1f7c
2 changed files with 13 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ type Props = Readonly<{
) => void;
onSelect: (option: TypeaheadOption) => void;
options: ReadonlyArray<TypeaheadOption>;
placeholder?: string;
value?: TypeaheadOption;
}>;
@@ -35,6 +36,7 @@ export default function Typeahead({
onQueryChange,
value,
onSelect,
placeholder,
}: Props) {
const [query, setQuery] = useState('');
return (
@@ -77,6 +79,7 @@ export default function Typeahead({
displayValue={(option) =>
(option as unknown as TypeaheadOption)?.label
}
placeholder={placeholder}
onChange={(event) => {
setQuery(event.target.value);
onQueryChange(event.target.value, event);