-
Notifications
You must be signed in to change notification settings - Fork 6
/
gatsby-browser.tsx
38 lines (34 loc) · 1.13 KB
/
gatsby-browser.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
/* eslint-disable import/prefer-default-export, react/prop-types */
import React from "react";
import { SettingsProvider } from "./src/contexts/settings-context";
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";
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}>
<CssBaseline />
{props.children}
</SnackbarProvider>
</ThemeProvider>
</ReduxProvider>
</SettingsProvider>
);
}
export const wrapRootElement = ({ element }) => {
return <TopLayout>{element}</TopLayout>;
};