forked from harshptl14/toolpool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Layout.js
31 lines (26 loc) · 893 Bytes
/
Layout.js
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
import styled, { ThemeProvider } from "styled-components";
import ToastContextProvider from "./Toast/toastreducer";
import GlobalStyle from "../styles/GlobalStyle";
import Navbar from "./Navbar";
import { useDarkMode } from '../hooks/useDarkMode';
import { lightTheme, darkTheme } from "../styles/theme";
import Footer from "./Footer";
const GlobalPadding = styled.div`
${({ theme }) => theme.mixins.padding};
`;
let home = false;
const Layout = ({ children }) => {
const [theme, themeToggler] = useDarkMode();
const themeMode = theme === "light" ? lightTheme : darkTheme;
return (
<ThemeProvider theme={themeMode}>
<GlobalStyle />
<Navbar isHome={home} toggleTheme={themeToggler} />
<GlobalPadding>
<ToastContextProvider>{children}</ToastContextProvider>
</GlobalPadding>
<Footer />
</ThemeProvider>
);
};
export default Layout;