23 lines
642 B
TypeScript
23 lines
642 B
TypeScript
// app/providers.tsx (client)
|
|
'use client';
|
|
|
|
import { SessionProvider } from 'next-auth/react';
|
|
import { ThemeProvider } from 'next-themes';
|
|
import type { PropsWithChildren } from 'react';
|
|
|
|
type Props = PropsWithChildren<{ session?: any }>;
|
|
|
|
export function Providers({ children, session }: Props) {
|
|
return (
|
|
<SessionProvider session={session}>
|
|
<ThemeProvider
|
|
attribute="class" // toggles `class="dark"` on <html>
|
|
defaultTheme="dark" // default to dark to match server if you want dark by default
|
|
enableSystem={false}
|
|
>
|
|
{children}
|
|
</ThemeProvider>
|
|
</SessionProvider>
|
|
);
|
|
}
|