Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Community Maps Frontend
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Community Maps
Community Maps Frontend
Merge requests
!72
Display tooltip based on it's config
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Display tooltip based on it's config
hotfix/display_tooltip_on_marker_by_config
into
dev
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Dani Quilez
requested to merge
hotfix/display_tooltip_on_marker_by_config
into
dev
1 year ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
0
0
Merge request reports
Compare
dev
dev (base)
and
latest version
latest version
4df56818
1 commit,
1 year ago
1 file
+
16
−
6
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/components/Place/index.tsx
+
16
−
6
Options
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