Skip to content
Snippets Groups Projects

Display tooltip based on it's config

Merged Dani Quilez requested to merge hotfix/display_tooltip_on_marker_by_config into dev
1 file
+ 16
6
Compare changes
  • Side-by-side
  • Inline
import { useMapData } from '@maps/components/CommunityProvider'
import { useEffect, useRef, useContext } from 'react'
import { Marker, Tooltip as LeafletTooltip } from 'react-leaflet'
import type { LeafletEventHandlerFnMap } from 'leaflet'
import Tooltip from '../Tooltip'
import type { Place as PlaceType } from '@maps/types/index'
import { useMarkerPercentage } from '@maps/components/Marker/roundedMarker'
@@ -68,14 +68,24 @@ export default function Place({
}
}, [isOpenPlace, onClick, place])
const { config } = useMapData()
if (config.displayTooltipOnMarker) {
return (
<>
<div />
<Marker icon={icon} position={latLng} eventHandlers={eventHandlers}>
<LeafletTooltip direction='top'>
<Tooltip displayName={place?.name} color={markerColor} />
</LeafletTooltip>
</Marker>
</>
)
}
return (
<>
<div />
<Marker icon={icon} position={latLng} eventHandlers={eventHandlers}>
<LeafletTooltip direction='top'>
<Tooltip displayName={place?.name} color={markerColor} />
</LeafletTooltip>
</Marker>
<Marker icon={icon} position={latLng} eventHandlers={eventHandlers} />
</>
)
}
Loading