From c2fdf98139508a7e43f6e198e3183c8d8f2769e3 Mon Sep 17 00:00:00 2001 From: Jalil Arfaoui Date: Sun, 19 Feb 2023 18:56:52 +0100 Subject: [PATCH] fix: incoherent default mode --- src/routes/Liste/index.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/routes/Liste/index.tsx b/src/routes/Liste/index.tsx index b59a19d..77f6833 100644 --- a/src/routes/Liste/index.tsx +++ b/src/routes/Liste/index.tsx @@ -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(null) const [academie, setAcademie] = React.useState(null) const [nom, setNom] = React.useState(undefined) - const [viewMode, setViewMode ] = React.useState("map") + const [viewMode, setViewMode ] = React.useState(defaultMode) const filtreNom = (event: React.ChangeEvent) => setNom(event.target.value) @@ -46,7 +48,7 @@ export const ListeResistants = () => { { value: "list", label:
Liste
}, { value: "photos", label:
Photos
}, { value: "map", label:
Carte
}, - ]} size="xs" defaultValue="photos" onChange={(value) => setViewMode(value as ViewMode )} /> + ]} size="xs" defaultValue={defaultMode} onChange={(value) => setViewMode(value as ViewMode )} /> } placeholder="Nom" onChange={filtreNom}/>