Skip to content
Snippets Groups Projects
layout.tsx 1.32 KiB
Newer Older
Yusuf Akgül's avatar
Yusuf Akgül committed
import { Container, CssBaseline, ThemeProvider } from "@mui/material"
import { createContext, useState } from "react"
import { QueryClient, QueryClientProvider } from "react-query"
Yusuf Akgül's avatar
Yusuf Akgül committed
import Header from "../components/Header"
import { Theme } from "./theme"
Yusuf Akgül's avatar
Yusuf Akgül committed
// metadata for the website
export const metadata = {
Yusuf Akgül's avatar
Yusuf Akgül committed
// for dark mode global context
export const ColorModeContext = createContext({ toggleColorMode: () => { } });

// this is the root layout for all pages ({children})
export default function RootLayout({
  children,
}: {
  children: React.ReactNode
}) {
  const [queryClient] = useState(() => new QueryClient());

Yusuf Akgül's avatar
Yusuf Akgül committed
  const [theme, colorMode] = Theme();
  return (
    <html lang="en">
Yusuf Akgül's avatar
Yusuf Akgül committed
        <ColorModeContext.Provider value={colorMode}>
          <ThemeProvider theme={theme}>
            <CssBaseline />
            <body>
              <Container maxWidth={false}>
                <Header />
                {children}
              </Container>
            </body>
          </ThemeProvider>
        </ColorModeContext.Provider>

// custom super small breakpoint for responsive design
declare module '@mui/material/styles' {
  interface BreakpointOverrides {
    ss: true;
  }
}