Something went wrong. Try again.
A comprehensive digital solution dedicated to bridging the gap between those offering services and those seeking them, providing a centrali… gigwork.co.in
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748'use client'
import React from 'react'import { MapContainer, TileLayer, Marker, Popup } from 'react-leaflet'import L from 'leaflet'import 'leaflet/dist/leaflet.css'
interface MapComponentProps { position: [number, number] popupText?: string}
const MapComponent: React.FC<MapComponentProps> = ({ position, popupText = 'Business Location' }) => { // Define custom icon inline const customIcon = new L.Icon({ iconUrl: '/marker-icon.png', iconRetinaUrl: '/marker-icon-2x.png', shadowUrl: '/marker-shadow.png', iconSize: [25, 41], iconAnchor: [12, 41], popupAnchor: [1, -34], shadowSize: [41, 41] });
return ( <MapContainer center={position} zoom={15} scrollWheelZoom={false} style={{ height: '300px', width: '100%', borderRadius: '0.375rem' }} > <TileLayer attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" /> <Marker position={position} icon={customIcon}> <Popup> {popupText} </Popup> </Marker> </MapContainer> )}
export default MapComponent