diff --git a/client/src/assets/img/pin-ghost.svg b/client/src/assets/img/pin-ghost.svg new file mode 100644 index 0000000..0458f8d --- /dev/null +++ b/client/src/assets/img/pin-ghost.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/assets/img/pin.svg b/client/src/assets/img/pin.svg index 7c0583e..cf772bb 100644 --- a/client/src/assets/img/pin.svg +++ b/client/src/assets/img/pin.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/client/src/assets/styles/main.css b/client/src/assets/styles/main.css index b95ef2b..79af2d6 100644 --- a/client/src/assets/styles/main.css +++ b/client/src/assets/styles/main.css @@ -74,6 +74,27 @@ height: 100% !important; } +main .leaflet-popup-content p { + margin: 4px 0 !important; + color: #fafafa !important; +} + +main .leaflet-popup-tip { + background-color: #656565 !important; +} + +main .leaflet-popup-content-wrapper { + background-color: #656565 !important; +} + +main .leaflet-container a.leaflet-popup-close-button { + color: #fafafa !important; +} + +main .leaflet-popup { + border-radius: 8px !important; +} + .badge-display { transition: .21s ease-out; transform: rotate(0deg); diff --git a/client/src/components/map/Map.tsx b/client/src/components/map/Map.tsx index 52d8bc5..30f0659 100644 --- a/client/src/components/map/Map.tsx +++ b/client/src/components/map/Map.tsx @@ -4,14 +4,18 @@ import { Polyline, Popup, TileLayer, + useMap, } from "react-leaflet"; -import { Icon } from "leaflet"; +import { Icon, LatLng } from "leaflet"; import { Step } from "../../interfaces/step.interface"; +import { useEffect } from "react"; const Map = ({ + currentStep, steps, polylinePath, }: { + currentStep: Step | undefined; steps: Step[]; polylinePath: [number, number][]; }) => { @@ -22,14 +26,32 @@ const Map = ({ iconSize: [40, 40], }); + const customIconGhost = new Icon({ + iconUrl: "/src/assets/img/pin-ghost.svg", + iconSize: [40, 40], + }); + + const geolocalisation = currentStep ? new LatLng(currentStep.geolocalisation.latitude, currentStep.geolocalisation.longitude) : new LatLng(43.282, 5.405); + + const MapRecenter= ({ lat, lng, zoomLevel }: { lat: number; lng: number; zoomLevel: number }) => { + const map = useMap(); + + useEffect(() => { + map.flyTo([lat, lng], zoomLevel ); + }, [lat, lng]); + return null; + }; + return (
Étape n°{marker.etape}
+ Étape n°{marker.etape}{marker.date}
{marker.ville}