Skip to content

Commit

Permalink
fix(ui): Set MUI ThemeProvider on the complete website
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Mar 21, 2024
1 parent 8db3ef8 commit 4f1938c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 25 deletions.
19 changes: 18 additions & 1 deletion src/index.js → src/index.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ThemeProvider, createTheme } from '@mui/material/styles';
import CssBaseline from '@mui/material/CssBaseline';
import React from 'react';
import ReactDOM from 'react-dom/client';
import { createHashRouter, RouterProvider } from 'react-router-dom';
Expand Down Expand Up @@ -39,9 +41,24 @@ const router = createHashRouter([
}
]);

const darkTheme = createTheme({
palette: {
mode: 'dark',
background: {
default: "#27272a"
},
text:{
primary: "#e4e5e6"
}
},
});

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<RouterProvider router={router} />
<ThemeProvider theme={darkTheme}>
<CssBaseline />
<RouterProvider router={router} />
</ThemeProvider>
</React.StrictMode>
);
10 changes: 0 additions & 10 deletions src/index.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
body {
background-color: #27272a;
color: #e4e5e6;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
}

.open-trail {
margin: auto;
width: 75%;
Expand Down
16 changes: 2 additions & 14 deletions src/pages/trail.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import { Accordion, AccordionDetails, AccordionSummary, Box, Breadcrumbs, Grid, Link, Typography } from '@mui/material';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import CssBaseline from '@mui/material/CssBaseline';
import gpxParser from 'gpxparser';
import React, { useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';
Expand All @@ -19,15 +17,6 @@ import gpxTourDuQueyras from '../data/tour-du-queyras.gpx';
import data from '../data/data.json';
import { chunkArray, downSampleArray, getClosestPointByCoordinates, getDataFromOverpass, getMarkerFromType, getTypeFromName } from '../utils';

const darkTheme = createTheme({
palette: {
mode: 'dark',
primary: {
main: '#fff',
},
},
});

const Trail = () => {
const params = useParams();

Expand Down Expand Up @@ -148,8 +137,7 @@ const Trail = () => {
}, [filters]);

return (
<ThemeProvider theme={darkTheme}>
<CssBaseline />
<>
{gpx && (
<Box className='open-trail' sx={{ flexGrow: 0.75 }}>
<Grid container spacing={{ xs: 2, md: 3 }} columns={{ xs: 4, sm: 8, md: 12 }}>
Expand Down Expand Up @@ -216,7 +204,7 @@ const Trail = () => {
</Grid>
</Box>
)}
</ThemeProvider>
</>
);
};

Expand Down

0 comments on commit 4f1938c

Please sign in to comment.