Skip to content

Commit 9bc2509

Browse files
committed
docs: add introductory modal to NearestMarkerExample for user guidance
1 parent bdbb52c commit 9bc2509

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

example/NearestMarkerExample.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const NearestMarkerExample = ({ themeMode, setThemeMode }: NearestMarkerExampleP
4545
const [nearestId, setNearestId] = useState<number | null>(null);
4646
const [nearestInfo, setNearestInfo] = useState<{ name: string; distance: number } | null>(null);
4747
const [engine, setEngine] = useState<Engine>("OSRM");
48+
const [showIntroModal, setShowIntroModal] = useState(true);
4849

4950
const [filteredDestinations, setFilteredDestinations] = useState(predefinedDestinations);
5051

@@ -254,6 +255,41 @@ const NearestMarkerExample = ({ themeMode, setThemeMode }: NearestMarkerExampleP
254255
</Typography>
255256
</Stack>
256257
</Box>
258+
259+
{showIntroModal && (
260+
<Box
261+
sx={{
262+
alignItems: "center",
263+
backgroundColor: "rgba(0, 0, 0, 0.5)",
264+
display: "flex",
265+
inset: 0,
266+
justifyContent: "center",
267+
position: "fixed",
268+
zIndex: 9999,
269+
}}
270+
>
271+
<Box
272+
sx={{
273+
backgroundColor: "background.paper",
274+
borderRadius: 2,
275+
boxShadow: 4,
276+
maxWidth: 380,
277+
p: 3,
278+
textAlign: "center",
279+
}}
280+
>
281+
<Typography variant="h6" gutterBottom>
282+
💡 Quick tip
283+
</Typography>
284+
<Typography variant="body2" color="text.secondary" sx={{ mb: 2 }}>
285+
Click on any <b>orange destination point</b> to remove it from the map.
286+
</Typography>
287+
<Button variant="contained" onClick={() => setShowIntroModal(false)}>
288+
Got it
289+
</Button>
290+
</Box>
291+
</Box>
292+
)}
257293
</Stack>
258294
</>
259295
);

0 commit comments

Comments
 (0)