From 7885d16acbb04cba8c7946d8435cd91da5a2b319 Mon Sep 17 00:00:00 2001 From: Zhi Date: Tue, 7 Nov 2023 03:16:45 +0800 Subject: [PATCH] Feature - Base UI --- client/components/map/FacilityCard.tsx | 158 +++++++++++++++++++----- client/spa-pages/components/MapPage.tsx | 22 +--- 2 files changed, 136 insertions(+), 44 deletions(-) diff --git a/client/components/map/FacilityCard.tsx b/client/components/map/FacilityCard.tsx index a084de9..f0020e6 100644 --- a/client/components/map/FacilityCard.tsx +++ b/client/components/map/FacilityCard.tsx @@ -1,49 +1,151 @@ -import { Flex, Text, HStack, Button } from "@chakra-ui/react"; +import { Flex, Text, HStack, Button, Box, VStack, Divider } from "@chakra-ui/react"; import { TStateFacilities } from "app-context/SheetyContext/types"; import { Image } from "@chakra-ui/react"; +import { ChevronDownIcon, ChevronUpIcon, ExternalLinkIcon } from "@chakra-ui/icons"; import { COLORS } from "theme"; +import React, { ReactNode, useState } from "react"; +import styles from "components/home/hideScrollbar.module.css"; +import Link from "next/link"; + export const FacilityCard = ({ facCardDetails, facCardDistance, - width, - left, }: { facCardDetails: TStateFacilities; facCardDistance: number; - width: string; - left: string; }) => { + const TRANSLATION_DIST = -50; + const [translateY, setTranslateY] = useState(0); + const handleMovement = () => { + translateY === TRANSLATION_DIST ? setTranslateY(0) : setTranslateY(TRANSLATION_DIST); + }; + const widths = ["86%", "50%", "40%", "25%"]; + const lefts = ["7%", "25%", "30%", "37.5%"]; return ( - Image not found. - - - {facCardDetails.channelName} - - - Address: {facCardDetails.address} - - - Categories Accepted: - {facCardDetails.categoriesAccepted.map((category) => category + ", ")} - - - - {Math.trunc(facCardDistance * 1000)}m away - - + {/* Gradient */} + {translateY === 0 && ( + + )} + {/* */} + + + + + Image not found. + + + + {Math.trunc(facCardDistance * 1000)}m + + + {facCardDetails.channelName} + + + {/* Address:{" "} */} + {facCardDetails.address} + + + + + + They accept X of {facCardDetails.categoriesAccepted.length} items: + + + {facCardDetails.categoriesAccepted.map((category, idx) => ( + {category} + ))} + + + They also accept these items: + + + {facCardDetails.categoriesAccepted.map((category, idx) => ( + {category} + ))} + + + Please check here for more information. + + + + Still got things to recycle? +
+ Uncle sem help you find a place for them: +
+ +
); }; + +const ItemTab: React.FC<{ children: ReactNode }> = ({ children }) => { + return ( + + {children} + + ); +}; diff --git a/client/spa-pages/components/MapPage.tsx b/client/spa-pages/components/MapPage.tsx index 160e371..040ebb5 100644 --- a/client/spa-pages/components/MapPage.tsx +++ b/client/spa-pages/components/MapPage.tsx @@ -378,22 +378,12 @@ const MapInner = ({ setPage }: Props) => { handleChangedLocation={handleChangedLocation} /> - {facCardIsOpen && - (isMobile ? ( - - ) : ( - - ))} + {facCardIsOpen && ( + + )} {/* Keeping this for future implementations of similar idea */}