CemeteryStep: autocomplete search replaces dropdown, lighter labels
- Select dropdown replaced with MUI Autocomplete (type-to-search with search icon) — scalable for large cemetery lists - Heavy h5 headings replaced with body1 contextual text - In production, parent can wire this to Google Places API Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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<CemeteryStepProps> = ({
|
||||
{/* ─── Own plot: tell us where ─── */}
|
||||
<Collapse in={showCemeteryForOwnPlot}>
|
||||
<Box sx={{ mb: 4 }}>
|
||||
<Typography variant="h5" component="h2" sx={{ mb: 3 }}>
|
||||
Tell us where the burial plot is located
|
||||
<Typography variant="body1" color="text.secondary" sx={{ mb: 2 }}>
|
||||
Tell us where the burial plot is located.
|
||||
</Typography>
|
||||
|
||||
<Autocomplete
|
||||
options={cemeteries}
|
||||
getOptionLabel={(option) => option.label}
|
||||
value={cemeteries.find((c) => c.value === values.selectedCemetery) ?? null}
|
||||
onChange={(_, option) =>
|
||||
onChange({ ...values, selectedCemetery: option?.value ?? '' })
|
||||
}
|
||||
renderInput={(params) => (
|
||||
<TextField
|
||||
select
|
||||
label="Cemetery"
|
||||
value={values.selectedCemetery}
|
||||
onChange={(e) => onChange({ ...values, selectedCemetery: e.target.value })}
|
||||
placeholder="Select a cemetery"
|
||||
fullWidth
|
||||
{...params}
|
||||
placeholder="Search for a cemetery..."
|
||||
error={!!errors?.selectedCemetery}
|
||||
helperText={errors?.selectedCemetery}
|
||||
>
|
||||
<MenuItem value="" disabled>
|
||||
Select a cemetery
|
||||
</MenuItem>
|
||||
{cemeteries.map((c) => (
|
||||
<MenuItem key={c.value} value={c.value}>
|
||||
{c.label}
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
InputProps={{
|
||||
...params.InputProps,
|
||||
startAdornment: (
|
||||
<InputAdornment position="start">
|
||||
<SearchOutlinedIcon sx={{ fontSize: 20, color: 'text.secondary' }} />
|
||||
</InputAdornment>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
noOptionsText="No cemeteries found"
|
||||
fullWidth
|
||||
/>
|
||||
</Box>
|
||||
</Collapse>
|
||||
|
||||
@@ -220,32 +229,35 @@ export const CemeteryStep: React.FC<CemeteryStepProps> = ({
|
||||
</Box>
|
||||
</Collapse>
|
||||
|
||||
{/* ─── Preference: select cemetery ─── */}
|
||||
{/* ─── Preference: search cemetery ─── */}
|
||||
<Collapse in={showCemeteryForPreference}>
|
||||
<Box sx={{ mb: 4 }}>
|
||||
<Typography variant="h5" component="h2" sx={{ mb: 3 }}>
|
||||
Select your preferred cemetery
|
||||
</Typography>
|
||||
|
||||
<Autocomplete
|
||||
options={cemeteries}
|
||||
getOptionLabel={(option) => option.label}
|
||||
value={cemeteries.find((c) => c.value === values.selectedCemetery) ?? null}
|
||||
onChange={(_, option) =>
|
||||
onChange({ ...values, selectedCemetery: option?.value ?? '' })
|
||||
}
|
||||
renderInput={(params) => (
|
||||
<TextField
|
||||
select
|
||||
label="Cemetery"
|
||||
value={values.selectedCemetery}
|
||||
onChange={(e) => onChange({ ...values, selectedCemetery: e.target.value })}
|
||||
placeholder="Select a cemetery"
|
||||
fullWidth
|
||||
{...params}
|
||||
placeholder="Search for a cemetery..."
|
||||
error={!!errors?.selectedCemetery}
|
||||
helperText={errors?.selectedCemetery}
|
||||
>
|
||||
<MenuItem value="" disabled>
|
||||
Select a cemetery
|
||||
</MenuItem>
|
||||
{cemeteries.map((c) => (
|
||||
<MenuItem key={c.value} value={c.value}>
|
||||
{c.label}
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
InputProps={{
|
||||
...params.InputProps,
|
||||
startAdornment: (
|
||||
<InputAdornment position="start">
|
||||
<SearchOutlinedIcon sx={{ fontSize: 20, color: 'text.secondary' }} />
|
||||
</InputAdornment>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
noOptionsText="No cemeteries found"
|
||||
fullWidth
|
||||
/>
|
||||
</Box>
|
||||
</Collapse>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user