diff --git a/app/components/RegionDataV2.tsx b/app/components/RegionDataV2.tsx
index 0c27ca4..0766f2f 100644
--- a/app/components/RegionDataV2.tsx
+++ b/app/components/RegionDataV2.tsx
@@ -5,6 +5,8 @@ import BloodTypeDataTile from "./BloodTypeDataTile";
import { Link } from "@remix-run/react";
import InformationCircle from "~/icons/information-circle";
import { Popover, PopoverButton, PopoverPanel } from "@headlessui/react";
+import { useLayoutEffect, useState } from "react";
+import { FaRegStar, FaStar } from "react-icons/fa";
export default function RegionData({
transplantData,
@@ -28,18 +30,64 @@ export default function RegionData({
>;
regionNumber: number;
}) {
+ const [regionFavorite, setRegionFavorite] = useState(false);
+
+ function handleSetRegionFavorite(region: string) {
+ if (regionFavorite) {
+ localStorage.setItem(region, "false");
+ localStorage.removeItem(region);
+ setRegionFavorite(false);
+ } else {
+ localStorage.setItem(region, "true");
+ setRegionFavorite(true);
+ }
+ }
+ useLayoutEffect(() => {
+ const isFave = window.localStorage.getItem(`Region${regionNumber}`);
+ if (isFave) {
+ localStorage.setItem(`Region${regionNumber}`, "true");
+ setRegionFavorite(true);
+ }
+ }, []);
return (
<>
-
Region {regionNumber}
+
+
+
+ {regionFavorite ? (
+
+ Region {regionNumber}
+
+ ) : (
+
Region {regionNumber}
+ )}
{/* may need to be bigger for a11y */}
-
+
-
+
- {regionStates(regionNumber).map(state => - {state}
)}
+ {regionStates(regionNumber).map((state) => (
+ - {state}
+ ))}
@@ -60,18 +108,46 @@ export default function RegionData({
*/}
-
-
-
-
-
-
+
+
+
+
+
+
>
))}
- View Trends
+
+ View Trends
+
>
diff --git a/package-lock.json b/package-lock.json
index 5f87a8b..cbfe5c0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -22,6 +22,7 @@
"nodemailer": "^6.9.12",
"react": "^18.2.0",
"react-dom": "^18.2.0",
+ "react-icons": "^5.3.0",
"recharts": "^2.12.3"
},
"devDependencies": {
@@ -9086,6 +9087,14 @@
"react": "^18.2.0"
}
},
+ "node_modules/react-icons": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-5.3.0.tgz",
+ "integrity": "sha512-DnUk8aFbTyQPSkCfF8dbX6kQjXA9DktMeJqfjrg6cK9vwQVMxmcA3BfP4QoiztVmEHtwlTgLFsPuH2NskKT6eg==",
+ "peerDependencies": {
+ "react": "*"
+ }
+ },
"node_modules/react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
diff --git a/package.json b/package.json
index 374b27b..7826663 100644
--- a/package.json
+++ b/package.json
@@ -33,6 +33,7 @@
"nodemailer": "^6.9.12",
"react": "^18.2.0",
"react-dom": "^18.2.0",
+ "react-icons": "^5.3.0",
"recharts": "^2.12.3"
},
"devDependencies": {