fix: next-themes

This commit is contained in:
iCrawl
2022-11-30 02:22:00 +01:00
parent 6bcebd4867
commit b0f9b9c344
6 changed files with 42 additions and 61 deletions

View File

@@ -1,5 +1,6 @@
'use client';
// import { ThemeProvider } from 'next-themes';
import type { PropsWithChildren } from 'react';
import { CmdKProvider } from '~/contexts/cmdK';
import { NavProvider } from '~/contexts/nav';
@@ -7,7 +8,20 @@ import { NavProvider } from '~/contexts/nav';
export function Providers({ children }: PropsWithChildren) {
return (
<NavProvider>
<CmdKProvider>{children}</CmdKProvider>
<CmdKProvider>
{/* <ThemeProvider
attribute="class"
cookieName="theme"
defaultTheme="system"
disableTransitionOnChange
value={{
light: 'light',
dark: 'dark',
}}
> */}
{children}
{/* </ThemeProvider> */}
</CmdKProvider>
</NavProvider>
);
}

View File

@@ -1,5 +1,5 @@
import { ServerThemeProvider } from 'next-themes';
import type { PropsWithChildren } from 'react';
import { Providers } from './providers';
import '@unocss/reset/tailwind.css';
import '../styles/inter.css';
@@ -9,11 +9,19 @@ import '../styles/main.css';
export default function RootLayout({ children }: PropsWithChildren) {
return (
<html lang="en">
<head />
<body className="dark:bg-dark-800 bg-white">
<Providers>{children}</Providers>
</body>
</html>
<ServerThemeProvider
attribute="class"
defaultTheme="system"
disableTransitionOnChange
value={{
light: 'light',
dark: 'dark',
}}
>
<html lang="en">
<head />
<body className="dark:bg-dark-800 bg-white">{children}</body>
</html>
</ServerThemeProvider>
);
}

View File

@@ -1,20 +0,0 @@
'use client';
import { ThemeProvider } from 'next-themes';
import type { PropsWithChildren } from 'react';
export function Providers({ children }: PropsWithChildren) {
return (
<ThemeProvider
attribute="class"
defaultTheme="system"
disableTransitionOnChange
value={{
light: 'light',
dark: 'dark',
}}
>
{children}
</ThemeProvider>
);
}