-
-
Notifications
You must be signed in to change notification settings - Fork 64
/
Routes.jsx
51 lines (48 loc) · 1.75 KB
/
Routes.jsx
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
import React from 'react';
import {
Routes, Route, Navigate, useLocation,
} from 'react-router-dom';
import { ThemeProvider, StyledEngineProvider } from '@mui/material/styles';
import Paper from '@mui/material/Paper';
import Box from '@mui/material/Box';
import queryString from 'query-string';
import theme, { darkTheme } from '@theme/theme';
import Desktop from '@components/main/Desktop';
import Faqs from '@components/main/Faqs';
import About from '@components/main/About';
import Contact from '@components/contact/Contact';
import Privacy from '@components/main/Privacy';
import ContentBottom from '@components/common/ContentBottom';
export default function AppRoutes() {
const { pathname, search } = useLocation();
const values = queryString.parse(search);
return (
<>
{/* Dark Theme - Map. */}
<StyledEngineProvider injectFirst>
<ThemeProvider theme={darkTheme}>
<Paper elevation={0}>
<Box visibility={pathname !== '/map' ? 'hidden' : 'visible'}>
<Desktop initialState={values} />
</Box>
</Paper>
</ThemeProvider>
</StyledEngineProvider>
{/* /* Default theme - Everything else. */ }
<StyledEngineProvider injectFirst>
<ThemeProvider theme={theme}>
<Paper elevation={0}>
<Routes>
<Route path="/faqs" element={<Faqs />} />
<Route path="/about" element={<About />} />
<Route path="/contact" element={<Contact />} />
<Route path="/" element={<Navigate to={`map${search}`} />} />
<Route path="/privacy" element={<Privacy />} />
</Routes>
<ContentBottom />
</Paper>
</ThemeProvider>
</StyledEngineProvider>
</>
);
}