forked from PinSpace-Org/GistPin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMap.tsx
More file actions
34 lines (30 loc) 路 1.07 KB
/
Copy pathMap.tsx
File metadata and controls
34 lines (30 loc) 路 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"use client";
import { MapContainer, TileLayer, Marker, Popup } from "react-leaflet";
import "leaflet/dist/leaflet.css";
import { icon } from "leaflet";
// Define green icon marker
const greenIcon = icon({
iconUrl:
"https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-green.png",
shadowUrl:
"https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
shadowSize: [41, 41],
});
export default function Map() {
const position: [number, number] = [9.0765, 7.3986];
return (
<MapContainer center={position} zoom={13} className="h-full w-full">
<TileLayer
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
{/* Use the new greenIcon here */}
<Marker position={position} icon={greenIcon}>
<Popup>A green GistPin from Abuja! 馃嚦馃嚞</Popup>
</Marker>
</MapContainer>
);
}