From 2703ff7dc8355cfe890ca3417ee701cfc0e4f59e Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 14 Mar 2025 21:10:40 +0000 Subject: [PATCH] [frontend]: Create BusStopPopup --- frontend/src/components/BusStopPopup.jsx | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 frontend/src/components/BusStopPopup.jsx diff --git a/frontend/src/components/BusStopPopup.jsx b/frontend/src/components/BusStopPopup.jsx new file mode 100644 index 0000000..89b8b1c --- /dev/null +++ b/frontend/src/components/BusStopPopup.jsx @@ -0,0 +1,34 @@ +import React, { useState } from "react"; +import { useMap } from "react-leaflet"; + +const BusStopPopup = ({ item, objectTitle, toggleFavourite, favourites }) => { + const [isFavourite, setIsFavourite] = useState(favourites.BusStop?.includes(item.busStopID)); + + const handleToggleFavourite = () => { + toggleFavourite("BusStop", item.busStopID); + setIsFavourite((prev) => !prev); + }; + + const map = useMap(); // Access the Leaflet map instance + + return ( +
+
+

{objectTitle}

+ +
+ +
+ ); +}; + +export default BusStopPopup; \ No newline at end of file