From 9f2f33cb877e6be16a66c033f3aa11264c8f11b3 Mon Sep 17 00:00:00 2001 From: Jalil Arfaoui Date: Tue, 7 Feb 2023 01:05:45 +0100 Subject: [PATCH] extract FiltreDepartement in own file --- src/routes/Liste/FiltreDepartement.tsx | 34 ++++++++ .../{ListeResistants.css => Liste/index.css} | 0 src/routes/Liste/index.tsx | 45 +++++++++++ src/routes/ListeResistants.tsx | 78 ------------------- 4 files changed, 79 insertions(+), 78 deletions(-) create mode 100644 src/routes/Liste/FiltreDepartement.tsx rename src/routes/{ListeResistants.css => Liste/index.css} (100%) create mode 100644 src/routes/Liste/index.tsx delete mode 100644 src/routes/ListeResistants.tsx diff --git a/src/routes/Liste/FiltreDepartement.tsx b/src/routes/Liste/FiltreDepartement.tsx new file mode 100644 index 0000000..4d28f82 --- /dev/null +++ b/src/routes/Liste/FiltreDepartement.tsx @@ -0,0 +1,34 @@ +import {Select} from "@mantine/core"; +import {IconMapPin} from "@tabler/icons-react"; +import React from "react"; + +export const FiltreDepartement = (props: { onChange: (value: string) => void }) => +   + + + + {resistants + .filter(r => !nom || normalize(r.noms).includes(normalize(nom.toLowerCase()))) + .filter(r => !departement || normalize(r.departement).includes(normalize(departement))) + .map((r) => )} + + + + ); +}; diff --git a/src/routes/ListeResistants.tsx b/src/routes/ListeResistants.tsx deleted file mode 100644 index 6f12543..0000000 --- a/src/routes/ListeResistants.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import React from "react"; -import { Outlet, useLoaderData } from "react-router"; -import {ResistantRow} from "./ResistantRow"; -import {Resistant} from "../Resistant"; -import {Group, Select} from "@mantine/core"; -import { IconMapPin } from "@tabler/icons-react"; - -export const resistantsLoader = async () => { - const spreadsheetId = '1GL1MBChnwNn0t8WtKK5M3PbtCJ_bTJRhoTwAI9jeWck' - let sheetName = "RésistantsW"; - const parser = new PublicGoogleSheetsParser() - const resistants = await parser.parse(spreadsheetId, sheetName); - return { resistants } -} - -function FiltreDepartement(props: { onChange: (value: string) => void }) { - return -   - - - - {resistants - .filter(r => !nom || normalize(r.noms).includes(normalize(nom.toLowerCase()))) - .filter(r => !departement || normalize(r.departement).includes(normalize(departement))) - .map((r) => )} - - - - ); -};