49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
"use client";
|
||
import React, { useEffect, useRef } from "react";
|
||
import { MapContainer, TileLayer, Marker, Popup } from "react-leaflet";
|
||
import L from "leaflet";
|
||
// import MarkerIcon from "../../node_modules/leaflet/dist/images/marker-icon.png";
|
||
// import MarkerShadow from "../../node_modules/leaflet/dist/images/marker-shadow.png";
|
||
import "leaflet/dist/leaflet.css";
|
||
import { any } from "zod";
|
||
|
||
const Map = () => {
|
||
const markerRef = useRef<any>(null);
|
||
|
||
useEffect(() => {
|
||
if (markerRef.current) {
|
||
markerRef.current.openPopup()
|
||
}
|
||
}, []);
|
||
|
||
return (
|
||
<MapContainer
|
||
center={[31.8974, 54.3569]}
|
||
zoom={13}
|
||
style={{ height: "300px" }}
|
||
className=" rounded-lg max-w-full"
|
||
>
|
||
<TileLayer url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" />
|
||
<Marker
|
||
position={[31.8974, 54.3569]}
|
||
// icon={
|
||
// new L.Icon({
|
||
// iconUrl: MarkerIcon.src,
|
||
// iconRetinaUrl: MarkerIcon.src,
|
||
// iconSize: [25, 41],
|
||
// iconAnchor: [12.5, 41],
|
||
// popupAnchor: [0, -41],
|
||
// shadowUrl: MarkerShadow.src,
|
||
// shadowSize: [41, 41],
|
||
// })
|
||
// }
|
||
ref={markerRef}
|
||
>
|
||
<Popup className=" font-[Yekan] font-bold">داروخانه چمران</Popup>
|
||
</Marker>
|
||
</MapContainer>
|
||
);
|
||
};
|
||
|
||
export default Map;
|