diff --git a/client/components/map/FacilityCard.tsx b/client/components/map/FacilityCard.tsx
index 1b086a8..abfcd7a 100644
--- a/client/components/map/FacilityCard.tsx
+++ b/client/components/map/FacilityCard.tsx
@@ -8,7 +8,7 @@ import styles from "components/home/hideScrollbar.module.css";
import Link from "next/link";
import { useSheetyData } from "hooks/useSheetyData";
import { CheckIcon } from "@chakra-ui/icons";
-import { Categories } from "api/sheety/enums";
+import { categoriesProcessor } from "./utils";
export const FacilityCard = ({
items,
facCardDetails,
@@ -20,14 +20,12 @@ export const FacilityCard = ({
}) => {
const { getItemCategory } = useSheetyData();
- const TRANSLATION_DIST = -50;
- const [translateY, setTranslateY] = useState(0);
+ const [isExpanded, setIsExpanded] = useState(false);
+ const [translateY, setTranslateY] = useState(50);
const handleMovement = () => {
- translateY === TRANSLATION_DIST ? setTranslateY(0) : setTranslateY(TRANSLATION_DIST);
+ isExpanded ? setTranslateY(50) : setTranslateY(0);
+ setIsExpanded(!isExpanded);
};
- const widths = ["86%", "50%", "40%", "25%"];
- const lefts = ["7%", "25%", "30%", "37.5%"];
- const bottoms = ["-27%", "-27%", "-27%", "-27%", "-25%"];
const itemsAccepted = items.filter((item) => {
return facCardDetails.categoriesAccepted.includes(getItemCategory(item.name));
@@ -37,49 +35,33 @@ export const FacilityCard = ({
return !facCardDetails.categoriesAccepted.includes(getItemCategory(item.name));
});
- const capitalizeFirstLetter = (word: string) => {
- return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
- };
-
- const categoriesProcessor = (categories: Categories[]) => {
- const categorySplit = categories.map((category: Categories) => {
- const words = category.split("_");
- const capitaliseWords = words.map((word: string) => capitalizeFirstLetter(word));
- return capitaliseWords.join(" ");
- });
- return categorySplit.join(", ");
- };
-
return (
{/* Gradient */}
- {translateY === 0 && (
+ {!isExpanded && (
)}
- {/* */}
@@ -115,6 +98,7 @@ export const FacilityCard = ({
width={"100%"}
gap={3}
padding={3}
+ zIndex={1002}
>
Get directions
diff --git a/client/components/map/utils.ts b/client/components/map/utils.ts
new file mode 100644
index 0000000..16d6817
--- /dev/null
+++ b/client/components/map/utils.ts
@@ -0,0 +1,14 @@
+import { Categories } from "api/sheety/enums";
+
+const capitalizeFirstLetter = (word: string) => {
+ return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
+};
+
+export const categoriesProcessor = (categories: Categories[]) => {
+ const categorySplit = categories.map((category: Categories) => {
+ const words = category.split("_");
+ const capitaliseWords = words.map((word: string) => capitalizeFirstLetter(word));
+ return capitaliseWords.join(" ");
+ });
+ return categorySplit.join(", ");
+};
diff --git a/client/spa-pages/components/MapPage.tsx b/client/spa-pages/components/MapPage.tsx
index 67a031c..9060b25 100644
--- a/client/spa-pages/components/MapPage.tsx
+++ b/client/spa-pages/components/MapPage.tsx
@@ -4,7 +4,6 @@ import { Flex, VStack, Box, IconButton, useDisclosure } from "@chakra-ui/react";
import { Dispatch, SetStateAction, useState } from "react";
import { Pages } from "spa-pages/pageEnums";
import { useUserInputs } from "hooks/useUserSelection";
-import { useBreakpointValue } from "@chakra-ui/react";
import { TStateFacilities } from "app-context/SheetyContext/types";
import { useSheetyData } from "hooks/useSheetyData";
import { MAX_DISTANCE_KM, getNearbyFacilities } from "utils";
@@ -123,7 +122,6 @@ const MapInner = ({ setPage }: Props) => {
////// Variables //////
const isLoading = !map || !leafletWindow;
- const isMobile = useBreakpointValue({ base: true, md: false });
const zoom = 15;
let index = 0;
@@ -380,26 +378,6 @@ const MapInner = ({ setPage }: Props) => {
/>
)}
-
- {/* Keeping this for future implementations of similar idea */}
- {/* Pull up tab */}
- {/* */}
- {/* Panel upon pulling up */}
- {/* {isExpanded && (
- handleChangedLocation(itemState)}
- showFilter={() => setFilterShow(true)}
- nearbyLocations={nearbyLocations}
- getMatchingFacility={getMatchingFacility}
- />
- )} */}
onFilterClose()}