fix: incoherent default mode

proto-module-actu-react
Jalil Arfaoui 2023-02-19 18:56:52 +01:00
parent 926c79ad6f
commit c2fdf98139
1 changed files with 4 additions and 2 deletions

View File

@ -25,11 +25,13 @@ const normalize = (text: string) => (text || "")
type ViewMode = "list" | "photos" | "map";
export const ListeResistants = () => {
const defaultMode = "map"
const { resistants } = useLoaderData() as { resistants: Resistant[] }
const [departement, setDepartement] = React.useState<string|null>(null)
const [academie, setAcademie] = React.useState<string|null>(null)
const [nom, setNom] = React.useState<string|undefined>(undefined)
const [viewMode, setViewMode ] = React.useState<ViewMode>("map")
const [viewMode, setViewMode ] = React.useState<ViewMode>(defaultMode)
const filtreNom = (event: React.ChangeEvent<HTMLInputElement>) => setNom(event.target.value)
@ -46,7 +48,7 @@ export const ListeResistants = () => {
{ value: "list", label: <Center><IconList />Liste</Center>},
{ value: "photos", label: <Center><IconCameraSelfie />Photos</Center>},
{ value: "map", label: <Center><IconMap />Carte</Center>},
]} size="xs" defaultValue="photos" onChange={(value) => setViewMode(value as ViewMode )} />
]} size="xs" defaultValue={defaultMode} onChange={(value) => setViewMode(value as ViewMode )} />
<TextInput icon={<IconUsers />} placeholder="Nom" onChange={filtreNom}/>
<FiltreDepartement resistants={resistants} onChange={setDepartement}/>
<FiltreAcademie resistants={resistants} onChange={setAcademie}/>