Skip to content

Commit f47e085

Browse files
committed
docs: replace introductory modal with a dialog in NearestMarkerExample for improved user experience
1 parent 41fc4b6 commit f47e085

File tree

1 file changed

+61
-36
lines changed

1 file changed

+61
-36
lines changed

example/NearestMarkerExample.tsx

Lines changed: 61 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
import { Box, Button, FormControl, InputLabel, MenuItem, Select, Stack, Switch, Typography } from "@tracktor/design-system";
1+
import { WarningAmberRounded } from "@mui/icons-material";
2+
import {
3+
Box,
4+
Button,
5+
Dialog,
6+
DialogActions,
7+
DialogContent,
8+
DialogTitle,
9+
FormControl,
10+
InputLabel,
11+
MenuItem,
12+
Select,
13+
Stack,
14+
Switch,
15+
Typography,
16+
} from "@tracktor/design-system";
217
import Navbar from "example/Navbar.tsx";
318
import { useMemo, useState } from "react";
419
import type { ProjectionSpecification } from "react-map-gl";
@@ -255,42 +270,52 @@ const NearestMarkerExample = ({ themeMode, setThemeMode }: NearestMarkerExampleP
255270
</Typography>
256271
</Stack>
257272
</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-
)}
293273
</Stack>
274+
<Dialog
275+
open={showIntroModal}
276+
onClose={() => setShowIntroModal(false)}
277+
maxWidth="xs"
278+
fullWidth
279+
PaperProps={{
280+
sx: {
281+
"@keyframes fadeInScale": {
282+
from: { opacity: 0, transform: "scale(0.95)" },
283+
to: { opacity: 1, transform: "scale(1)" },
284+
},
285+
animation: "fadeInScale 0.35s ease-out",
286+
backgroundColor: "background.paper",
287+
borderRadius: 3,
288+
boxShadow: 6,
289+
p: 2,
290+
textAlign: "center",
291+
},
292+
}}
293+
>
294+
<DialogTitle>
295+
<Stack direction="row" justifyContent="center" alignItems="center" spacing={1}>
296+
<WarningAmberRounded color="warning" fontSize="large" />
297+
<Typography variant="h6" fontWeight={700}>
298+
Quick tip
299+
</Typography>
300+
</Stack>
301+
</DialogTitle>
302+
303+
<DialogContent>
304+
<Typography variant="body2" color="text.secondary" sx={{ mt: 1 }}>
305+
Click on any{" "}
306+
<Box component="span" sx={{ fontWeight: 600 }}>
307+
destination
308+
</Box>{" "}
309+
point to remove it from the map.
310+
</Typography>
311+
</DialogContent>
312+
313+
<DialogActions sx={{ justifyContent: "center" }}>
314+
<Button variant="contained" onClick={() => setShowIntroModal(false)} sx={{ minWidth: 100 }}>
315+
Got it
316+
</Button>
317+
</DialogActions>
318+
</Dialog>
294319
</>
295320
);
296321
};

0 commit comments

Comments
 (0)