-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathApp.js
More file actions
52 lines (45 loc) · 1.58 KB
/
App.js
File metadata and controls
52 lines (45 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import "./App.css";
import { MapLibreMap, MlNavigationTools } from "@mapcomponents/react-maplibre";
import DataLayer from "./components/dataLayer";
import "maplibre-gl/dist/maplibre-gl.css";
import TopBar from "./components/TopBar";
import ChooseLayer from "./components/ChooseLayer";
import { createTheme, ThemeProvider, useMediaQuery } from "@mui/material";
import { Route, Routes } from "react-router-dom";
const theme = createTheme({
palette: {
primary: { main: "#353535" },
secondary: { main: "#fafbfc" },
},
});
const pathname = window.location.pathname;
function App() {
const mediaIsMobile = useMediaQuery("(max-width:900px)");
return (
<>
<ThemeProvider theme={theme}>
<MapLibreMap
mapId="map_1"
options={{
zoom: 1.8,
style: "https://wms.wheregroup.com/tileserver/style/osm-fiord-color.json",
center: [0, 0],
}}
/>
<TopBar />
<ChooseLayer />
{mediaIsMobile ? (
<MlNavigationTools mapId="map1" showZoomButtons={false} />
) : (
<MlNavigationTools mapId="map1" showZoomButtons={true} />
)}
{/*Problem: Bei Suche wird DataLayer ein zweites mal geladen und doppelt übereinander dargestellt*/}
<Routes>
<Route path={pathname + ":searchWord"} element={<DataLayer />} />
<Route path={pathname} element={<DataLayer />} />
</Routes>
</ThemeProvider>
</>
);
}
export default App;