Skip to content

Commit

Permalink
feat: add context provider barrel to layout
Browse files Browse the repository at this point in the history
  • Loading branch information
rikhall1515 committed Apr 19, 2024
1 parent eb99174 commit d519d89
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { Metadata } from "next";
import { Inter } from "next/font/google";

import "./globals.css";
import Providers from "@/context";
import { env } from "@/env/client";
import { VERCEL_ENV } from "@/next.constants.mjs";
const inter = Inter({ subsets: ["latin"] });
Expand Down Expand Up @@ -33,9 +34,9 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
return (
<html lang="en">
<html lang="en" suppressHydrationWarning>
<body className={inter.className}>
{children}
<Providers>{children}</Providers>
{VERCEL_ENV && (
<>
<Analytics />
Expand Down
15 changes: 15 additions & 0 deletions context/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import CookieContextProvider from "./cookie";
import SidebarContextProvider from "./sidebar";
import ThemeContextProvider from "./theme";

export default function Providers({ children }: { children: React.ReactNode }) {
return (
<>
<ThemeContextProvider>
<SidebarContextProvider>
<CookieContextProvider>{children}</CookieContextProvider>
</SidebarContextProvider>
</ThemeContextProvider>
</>
);
}

0 comments on commit d519d89

Please sign in to comment.