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