fix: incoherent default mode
parent
926c79ad6f
commit
c2fdf98139
|
@ -25,11 +25,13 @@ const normalize = (text: string) => (text || "")
|
||||||
|
|
||||||
type ViewMode = "list" | "photos" | "map";
|
type ViewMode = "list" | "photos" | "map";
|
||||||
export const ListeResistants = () => {
|
export const ListeResistants = () => {
|
||||||
|
const defaultMode = "map"
|
||||||
|
|
||||||
const { resistants } = useLoaderData() as { resistants: Resistant[] }
|
const { resistants } = useLoaderData() as { resistants: Resistant[] }
|
||||||
const [departement, setDepartement] = React.useState<string|null>(null)
|
const [departement, setDepartement] = React.useState<string|null>(null)
|
||||||
const [academie, setAcademie] = React.useState<string|null>(null)
|
const [academie, setAcademie] = React.useState<string|null>(null)
|
||||||
const [nom, setNom] = React.useState<string|undefined>(undefined)
|
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)
|
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: "list", label: <Center><IconList />Liste</Center>},
|
||||||
{ value: "photos", label: <Center><IconCameraSelfie />Photos</Center>},
|
{ value: "photos", label: <Center><IconCameraSelfie />Photos</Center>},
|
||||||
{ value: "map", label: <Center><IconMap />Carte</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}/>
|
<TextInput icon={<IconUsers />} placeholder="Nom" onChange={filtreNom}/>
|
||||||
<FiltreDepartement resistants={resistants} onChange={setDepartement}/>
|
<FiltreDepartement resistants={resistants} onChange={setDepartement}/>
|
||||||
<FiltreAcademie resistants={resistants} onChange={setAcademie}/>
|
<FiltreAcademie resistants={resistants} onChange={setAcademie}/>
|
||||||
|
|
Loading…
Reference in New Issue