import React, { useRef, useEffect, useState } from 'react' import { Map, mapTheme } from '../../' import maplibregl from 'maplibre-gl' const MapDefault = (props) => { //set Map instance to access from outside useEffect const [mapInstance, setMapInstance] = useState(null) const mapContainerRef = useRef(null) //Set default position const defaultPosition = [-75.379143, 39.831200] // linking Maplibre methods to PB custom zoom in, zoom out, and fly to buttons const handleZoomIn = (map) => {map.zoomIn({...mapTheme.zoomConfig})} const handleZoomOut = (map) => {map.zoomOut({...mapTheme.zoomConfig})} const handleFlyTo = (map) => {map.flyTo({ center: defaultPosition, ... mapTheme.flyToConfig });} //This function is called by the useEffect when map instance first loads const loadMap = ( { target: map }) => { //set marker/pin new maplibregl.Marker({ color: mapTheme.marker, }).setLngLat(defaultPosition) .setPopup(new maplibregl.Popup({closeButton: false}).setHTML(`