Skip to content

Commit 2d14d2e

Browse files
authored
Merge pull request #5 from sysdevrun/claude/fix-popup-width-94svp
Fix vehicle popup width by removing incorrect absolute positioning
2 parents 8d6aca0 + 9f004bb commit 2d14d2e

2 files changed

Lines changed: 15 additions & 13 deletions

File tree

src/components/MapView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ export default function MapView({ client, routeMap, selectedVehicle, onVehicleCl
251251
if (!map || !selectedVehicle?.position || !client) return;
252252

253253
const container = document.createElement('div');
254-
popupRef.current = new maplibregl.Popup({ closeOnClick: false, maxWidth: '320px' })
254+
popupRef.current = new maplibregl.Popup({ closeOnClick: false, maxWidth: 'none' })
255255
.setLngLat([selectedVehicle.position.longitude, selectedVehicle.position.latitude])
256256
.setDOMContent(container)
257257
.addTo(map);

src/components/VehiclePopup.css

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
.vehicle-popup {
2-
position: absolute;
3-
bottom: 16px;
4-
left: 16px;
5-
z-index: 15;
62
background: white;
7-
border-radius: 12px;
8-
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
3+
border-radius: 8px;
94
width: 320px;
105
max-width: calc(100vw - 32px);
116
overflow: hidden;
@@ -133,13 +128,20 @@
133128
color: #999;
134129
}
135130

131+
/* Remove default padding from MapLibre popup container */
132+
.maplibregl-popup-content {
133+
padding: 0;
134+
border-radius: 8px;
135+
overflow: hidden;
136+
}
137+
138+
/* Hide the default MapLibre close button (we use our own) */
139+
.maplibregl-popup-close-button {
140+
display: none;
141+
}
142+
136143
@media (max-width: 600px) {
137144
.vehicle-popup {
138-
bottom: 0;
139-
left: 0;
140-
right: 0;
141-
width: auto;
142-
max-width: none;
143-
border-radius: 12px 12px 0 0;
145+
width: 260px;
144146
}
145147
}

0 commit comments

Comments
 (0)