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 { 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 type { MapRef } from "react-map-gl/maplibre";
|
||||
import type { FlatGeoCheck } from "@/Types/GeoCheck";
|
||||
@@ -15,6 +15,21 @@ export const GeoChecksMap = ({ geoChecks }: GeoChecksMapProps) => {
|
||||
const theme = useTheme();
|
||||
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(() => {
|
||||
if (geoChecks.length === 0 || !mapRef.current) return;
|
||||
|
||||
@@ -55,8 +70,13 @@ export const GeoChecksMap = ({ geoChecks }: GeoChecksMapProps) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{ height: "500px", width: "100%", borderRadius: "8px", overflow: "hidden" }}
|
||||
<>
|
||||
{mapPopupStyles}
|
||||
<Box
|
||||
height={500}
|
||||
width={"100%"}
|
||||
borderRadius={theme.shape.borderRadius}
|
||||
overflow={"hidden"}
|
||||
>
|
||||
<Map
|
||||
ref={mapRef}
|
||||
@@ -104,7 +124,17 @@ export const GeoChecksMap = ({ geoChecks }: GeoChecksMapProps) => {
|
||||
onClose={() => setSelectedCheck(null)}
|
||||
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
|
||||
variant="subtitle1"
|
||||
fontWeight="bold"
|
||||
@@ -152,6 +182,7 @@ export const GeoChecksMap = ({ geoChecks }: GeoChecksMapProps) => {
|
||||
</Popup>
|
||||
)}
|
||||
</Map>
|
||||
</div>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
Vendored
+5
@@ -17,3 +17,8 @@ declare module "*.svg?react" {
|
||||
>;
|
||||
export default ReactComponent;
|
||||
}
|
||||
|
||||
declare module "*.css" {
|
||||
const content: string;
|
||||
export default content;
|
||||
}
|
||||
Reference in new issue
Block a user