diff --git a/src/pages/admin/groupes.js b/src/pages/admin/groupes.js index ea457c9d..252392a7 100644 --- a/src/pages/admin/groupes.js +++ b/src/pages/admin/groupes.js @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react'; import { Link as RouterLink } from 'react-router-dom'; -import { Breadcrumb, BreadcrumbItem, Col, Modal, ModalTitle, ModalContent, Row, Tag, Text } from '@dataesr/react-dsfr'; +import { Breadcrumb, BreadcrumbItem, Col, Modal, ModalTitle, ModalContent, Row, Tag, Text, TextInput } from '@dataesr/react-dsfr'; import Button from '../../components/button'; import useFetch from '../../hooks/useFetch'; import GroupForm from '../../components/forms/groups'; @@ -19,6 +19,7 @@ export default function GroupsPage() { const [modalContent, setModalContent] = useState(null); const { notice } = useNotice(); const { setEditMode } = useEditMode(); + const [searchQuery, setSearchQuery] = useState(''); useEffect(() => setEditMode(true), [setEditMode]); @@ -51,27 +52,56 @@ export default function GroupsPage() { ); setIsOpen(true); }; + const filteredData = data?.data.filter((item) => item?.name?.toLowerCase().includes(searchQuery.toLowerCase())); const renderGroups = () => { if (!data || !data.data?.length) return null; - return data.data.map((group) => ( -