blob: 1179bdfe65fb72530fc6a3a6f65e6bd2895a04db (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
"use client";
import type { ThemeProviderProps } from "next-themes";
import * as React from "react";
import { ThemeProvider as NextThemesProvider, useTheme } from "next-themes";
export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
return (
<NextThemesProvider scriptProps={{ "data-cfasync": "false" }} {...props}>
{children}
</NextThemesProvider>
);
}
export function useToggleTheme() {
const { theme, setTheme } = useTheme();
if (theme == "dark") {
return () => setTheme("light");
} else {
return () => setTheme("dark");
}
}
|