fix toggle

This commit is contained in:
CanbiZ 2025-02-06 16:58:51 +01:00 committed by GitHub
parent f4d2d4f726
commit d46f1e4e95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,10 +2,21 @@
import { ThemeProvider as NextThemesProvider } from "next-themes";
import { type ThemeProviderProps } from "next-themes/dist/types";
import { useEffect, useState } from "react";
export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
const [mounted, setMounted] = useState(false);
useEffect(() => {
setMounted(true);
}, []);
if (!mounted) {
return <div className="bg-black h-screen w-screen" />;
}
return (
<NextThemesProvider defaultTheme="dark" enableSystem {...props}>
<NextThemesProvider attribute="class" defaultTheme="dark" enableSystem {...props}>
{children}
</NextThemesProvider>
);