diff --git a/src/Components/AutoComplete/AutoComplete.tsx b/src/Components/AutoComplete/AutoComplete.tsx deleted file mode 100644 index 09032bc1d..000000000 --- a/src/Components/AutoComplete/AutoComplete.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { Autocomplete, FormControl, FormHelperText, TextField } from '@mui/material'; -import { useMemo } from 'react'; -import { FormattedMessageType } from '../../Types/Questions'; - -type Props = { - value: string | null; - setValue: (newValue: string | null) => void; - options: string[]; - label: FormattedMessageType; - showError: boolean; - errorMessage: FormattedMessageType; -}; - -export default function AutoComplete({ options, label, value, setValue, showError, errorMessage }: Props) { - const autoCompleteOptions = useMemo(() => { - return options.map((value) => { - return { label: value }; - }); - }, [options]); - - const autoCompleteValue = value !== null ? { label: value } : null; - - return ( - - option.label === value.label} - options={autoCompleteOptions} - value={autoCompleteValue} - onChange={(event, newValue) => { - setValue(newValue?.label ?? null); - }} - renderInput={(params) => ( - { - if (options.includes(event.target.value)) { - setValue(event.target.value); - } - }} - /> - )} - /> - {showError && {errorMessage}} - - ); -}