diff --git a/src/components/pages/CemeteryStep/CemeteryStep.tsx b/src/components/pages/CemeteryStep/CemeteryStep.tsx index 1067349..65187d2 100644 --- a/src/components/pages/CemeteryStep/CemeteryStep.tsx +++ b/src/components/pages/CemeteryStep/CemeteryStep.tsx @@ -1,7 +1,9 @@ import React from 'react'; import Box from '@mui/material/Box'; +import Autocomplete from '@mui/material/Autocomplete'; import TextField from '@mui/material/TextField'; -import MenuItem from '@mui/material/MenuItem'; +import SearchOutlinedIcon from '@mui/icons-material/SearchOutlined'; +import InputAdornment from '@mui/material/InputAdornment'; import type { SxProps, Theme } from '@mui/material/styles'; import { WizardLayout } from '../../templates/WizardLayout'; import { ToggleButtonGroup } from '../../atoms/ToggleButtonGroup'; @@ -175,29 +177,36 @@ export const CemeteryStep: React.FC = ({ {/* ─── Own plot: tell us where ─── */} - - Tell us where the burial plot is located + + Tell us where the burial plot is located. - onChange({ ...values, selectedCemetery: e.target.value })} - placeholder="Select a cemetery" + option.label} + value={cemeteries.find((c) => c.value === values.selectedCemetery) ?? null} + onChange={(_, option) => + onChange({ ...values, selectedCemetery: option?.value ?? '' }) + } + renderInput={(params) => ( + + + + ), + }} + /> + )} + noOptionsText="No cemeteries found" fullWidth - error={!!errors?.selectedCemetery} - helperText={errors?.selectedCemetery} - > - - Select a cemetery - - {cemeteries.map((c) => ( - - {c.label} - - ))} - + /> @@ -220,32 +229,35 @@ export const CemeteryStep: React.FC = ({ - {/* ─── Preference: select cemetery ─── */} + {/* ─── Preference: search cemetery ─── */} - - Select your preferred cemetery - - - onChange({ ...values, selectedCemetery: e.target.value })} - placeholder="Select a cemetery" + option.label} + value={cemeteries.find((c) => c.value === values.selectedCemetery) ?? null} + onChange={(_, option) => + onChange({ ...values, selectedCemetery: option?.value ?? '' }) + } + renderInput={(params) => ( + + + + ), + }} + /> + )} + noOptionsText="No cemeteries found" fullWidth - error={!!errors?.selectedCemetery} - helperText={errors?.selectedCemetery} - > - - Select a cemetery - - {cemeteries.map((c) => ( - - {c.label} - - ))} - + />