diff --git a/src/routes/ListeResistants.tsx b/src/routes/ListeResistants.tsx index 2fcb09e..27e0812 100644 --- a/src/routes/ListeResistants.tsx +++ b/src/routes/ListeResistants.tsx @@ -1,3 +1,4 @@ +import React from "react"; import { Outlet, useLoaderData } from "react-router"; import {ResistantRow} from "./ResistantRow"; import {Resistant} from "../Resistant"; @@ -10,14 +11,47 @@ export const resistantsLoader = async () => { return { resistants } } +function FiltreDepartement(props: { onChange: (event: React.ChangeEvent) => void }) { + return ; +} + export const ListeResistants = () => { const { resistants } = useLoaderData() as { resistants: Resistant[] } + const [departement, setDepartement] = React.useState(null) + + const filtreDepartements = (event: React.ChangeEvent) => setDepartement(event.target.value) return ( <>
- {resistants.map((r) => )} - + + + {resistants + .filter(r => !departement || r.departement?.includes(departement)) + .map((r) => )} +
); diff --git a/src/routes/ResistantRow.tsx b/src/routes/ResistantRow.tsx index 19270ab..ac56960 100644 --- a/src/routes/ResistantRow.tsx +++ b/src/routes/ResistantRow.tsx @@ -13,7 +13,7 @@ export const ResistantRow = ({resistant}: Props) => {
-
+