mirror of
https://github.com/ClipFusion-org/clipfusion.git
synced 2025-08-03 14:45:09 +00:00
ui: fixed ThemeProvider
component
This commit is contained in:
parent
acda651d82
commit
7078330605
@ -4,9 +4,9 @@ import { ComponentProps, ReactNode } from "react";
|
||||
|
||||
const ThemeProvider = (props: ComponentProps<typeof NextThemeProvider>): ReactNode => {
|
||||
return (
|
||||
<ThemeProvider {...props} attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
|
||||
<NextThemeProvider {...props} attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
|
||||
{props.children}
|
||||
</ThemeProvider>
|
||||
</NextThemeProvider>
|
||||
)
|
||||
};
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
"use client";
|
||||
import { useTheme } from "next-themes";
|
||||
import { ReactNode, useCallback, useEffect, useState } from "react";
|
||||
import { Toggle } from "../ui/toggle";
|
||||
@ -15,11 +16,11 @@ export const ThemeSwitcher = ({
|
||||
const onThemeChange = useCallback(() => {
|
||||
setTheme(theme == "dark" ? "light" : "dark");
|
||||
setDark(!dark);
|
||||
}, [theme, dark, setTheme]);
|
||||
}, [theme, dark]);
|
||||
|
||||
useEffect(() => {
|
||||
setDark(theme == "dark");
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Toggle pressed={dark} onPressedChange={onThemeChange}>
|
||||
|
Loading…
Reference in New Issue
Block a user