blob: 1ab9a49d7c7f774145c941cafde23e3abdd31b8e (
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";
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");
}
}
|