(ui): Make GroupSelect controlled input

This commit is contained in:
Ken Hibino
2022-03-25 07:00:31 -07:00
parent f31f248937
commit 55de4e84eb
2 changed files with 22 additions and 1 deletions

View File

@@ -28,15 +28,27 @@ const useStyles = makeStyles((theme) => ({
}));
interface Props {
selected: GroupInfo | null;
onSelect: (newVal: GroupInfo | null) => void;
groups: GroupInfo[];
error: string;
}
export default function GroupSelect(props: Props) {
const classes = useStyles();
const [inputValue, setInputValue] = React.useState("");
return (
<Autocomplete
id="task-group-selector"
value={props.selected}
onChange={(event: any, newValue: GroupInfo | null) => {
props.onSelect(newValue);
}}
inputValue={inputValue}
onInputChange={(event, newInputValue) => {
setInputValue(newInputValue);
}}
disableListWrap
ListboxComponent={
ListboxComponent as React.ComponentType<