diff --git a/src/components/react/OfficerCard.jsx b/src/components/react/OfficerCard.jsx new file mode 100644 index 0000000..a6a53f0 --- /dev/null +++ b/src/components/react/OfficerCard.jsx @@ -0,0 +1,23 @@ +import React from "react"; + +const OfficerCard = ({ picture, name, position, email }) => ( +
+ {`Picture +
+

{name}

+

{position}

+ + {email} + +
+
+); + +export default OfficerCard; diff --git a/src/components/react/OfficerTabs.jsx b/src/components/react/OfficerTabs.jsx new file mode 100644 index 0000000..4f1138d --- /dev/null +++ b/src/components/react/OfficerTabs.jsx @@ -0,0 +1,50 @@ +import React, { useState } from "react"; +import OfficerCard from "./OfficerCard.jsx"; +import { AnimatePresence } from "framer-motion"; + +const OfficerTabs = ({ officers }) => { + const [selectedType, setSelectedType] = useState("All"); + + const uniqueTypes = [ + "All", + ...new Set(officers.flatMap((officer) => officer.type || [])), + ]; + + const filteredOfficers = + selectedType === "All" + ? officers + : officers.filter((officer) => + officer.type?.includes(selectedType) + ); + + return ( +
+
+ {uniqueTypes.map((type) => ( + + ))} +
+ +
+ {filteredOfficers.map((officer) => ( + + ))} +
+
+ ); +}; + +export default OfficerTabs;