move css styles
This commit is contained in:
1 parent
b68214fc47
commit
a9f005b2c4
2 files changed
+41
-5
No files matched your search
@@ -1,5 +1,5 @@
|
|||||||
import { useRef, useEffect, useState } from "react";
|
import { useRef, useEffect, useState } from "react";
|
||||||
import { Box, Typography, Stack, useTheme } from "@mui/material";
|
import { Box, Typography, Stack, useTheme, GlobalStyles } from "@mui/material";
|
||||||
import Map, { Marker, Popup } from "react-map-gl/maplibre";
|
import Map, { Marker, Popup } from "react-map-gl/maplibre";
|
||||||
import type { MapRef } from "react-map-gl/maplibre";
|
import type { MapRef } from "react-map-gl/maplibre";
|
||||||
import type { FlatGeoCheck } from "@/Types/GeoCheck";
|
import type { FlatGeoCheck } from "@/Types/GeoCheck";
|
||||||
@@ -15,6 +15,21 @@ export const GeoChecksMap = ({ geoChecks }: GeoChecksMapProps) => {
|
|||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isDarkMode = theme.palette.mode === "dark";
|
const isDarkMode = theme.palette.mode === "dark";
|
||||||
|
|
||||||
|
const mapPopupStyles = (
|
||||||
|
<GlobalStyles
|
||||||
|
styles={{
|
||||||
|
".maplibregl-popup-content": {
|
||||||
|
background: "transparent !important",
|
||||||
|
padding: "0 !important",
|
||||||
|
boxShadow: "none !important",
|
||||||
|
},
|
||||||
|
".maplibregl-popup-tip": {
|
||||||
|
display: "none !important",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (geoChecks.length === 0 || !mapRef.current) return;
|
if (geoChecks.length === 0 || !mapRef.current) return;
|
||||||
|
|
||||||
@@ -55,8 +70,13 @@ export const GeoChecksMap = ({ geoChecks }: GeoChecksMapProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<>
|
||||||
style={{ height: "500px", width: "100%", borderRadius: "8px", overflow: "hidden" }}
|
{mapPopupStyles}
|
||||||
|
<Box
|
||||||
|
height={500}
|
||||||
|
width={"100%"}
|
||||||
|
borderRadius={theme.shape.borderRadius}
|
||||||
|
overflow={"hidden"}
|
||||||
>
|
>
|
||||||
<Map
|
<Map
|
||||||
ref={mapRef}
|
ref={mapRef}
|
||||||
@@ -104,7 +124,17 @@ export const GeoChecksMap = ({ geoChecks }: GeoChecksMapProps) => {
|
|||||||
onClose={() => setSelectedCheck(null)}
|
onClose={() => setSelectedCheck(null)}
|
||||||
closeOnClick={false}
|
closeOnClick={false}
|
||||||
>
|
>
|
||||||
<Box sx={{ minWidth: 200, p: 1 }}>
|
<Box
|
||||||
|
sx={{
|
||||||
|
minWidth: 200,
|
||||||
|
p: theme.spacing(4),
|
||||||
|
bgcolor: theme.palette.background.paper,
|
||||||
|
borderWidth: 1,
|
||||||
|
borderStyle: "solid",
|
||||||
|
borderColor: theme.palette.divider,
|
||||||
|
borderRadius: 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Typography
|
<Typography
|
||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
fontWeight="bold"
|
fontWeight="bold"
|
||||||
@@ -152,6 +182,7 @@ export const GeoChecksMap = ({ geoChecks }: GeoChecksMapProps) => {
|
|||||||
</Popup>
|
</Popup>
|
||||||
)}
|
)}
|
||||||
</Map>
|
</Map>
|
||||||
</div>
|
</Box>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
Vendored
+5
@@ -17,3 +17,8 @@ declare module "*.svg?react" {
|
|||||||
>;
|
>;
|
||||||
export default ReactComponent;
|
export default ReactComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare module "*.css" {
|
||||||
|
const content: string;
|
||||||
|
export default content;
|
||||||
|
}
|
||||||
Reference in new issue
Block a user