-
Notifications
You must be signed in to change notification settings - Fork 6
/
gatsby-ssr.tsx
38 lines (36 loc) · 1.28 KB
/
gatsby-ssr.tsx
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
import React from "react";
import useSettings from "./src/hooks/useSettings";
import CssBaseline from "@mui/material/CssBaseline";
import { ThemeProvider } from "@mui/material/styles";
import { createTheme } from "./src/theme";
import { SnackbarProvider } from "notistack";
import { Provider as ReduxProvider } from "react-redux";
import store from "./src/store";
import { SettingsProvider } from "contexts/settings-context";
function TopLayout(props) {
const { settings } = useSettings();
const theme = createTheme({
direction: settings.direction,
responsiveFontSizes: settings.responsiveFontSizes,
theme: settings.theme,
lang: settings.lang,
});
return (
<>
<SettingsProvider>
<ReduxProvider store={store}>
<ThemeProvider theme={theme}>
<SnackbarProvider maxSnack={3}>
{/* <GlobalStyles /> */}
<CssBaseline />
{props.children}
</SnackbarProvider>
</ThemeProvider>
</ReduxProvider>
</SettingsProvider>
</>
);
}
export const wrapRootElement = ({ element }) => {
return <TopLayout>{element}</TopLayout>;
};