mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-11 10:19:16 +00:00
fix toggle
This commit is contained in:
parent
f4d2d4f726
commit
d46f1e4e95
@ -2,10 +2,21 @@
|
|||||||
|
|
||||||
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
||||||
import { type ThemeProviderProps } from "next-themes/dist/types";
|
import { type ThemeProviderProps } from "next-themes/dist/types";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
|
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 (
|
return (
|
||||||
<NextThemesProvider defaultTheme="dark" enableSystem {...props}>
|
<NextThemesProvider attribute="class" defaultTheme="dark" enableSystem {...props}>
|
||||||
{children}
|
{children}
|
||||||
</NextThemesProvider>
|
</NextThemesProvider>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user