13 lines
336 B
TypeScript
13 lines
336 B
TypeScript
|
|
import { useEffect } from 'react';
|
||
|
|
import { useThemeStore } from './theme-store';
|
||
|
|
|
||
|
|
export function ThemeProvider({ children }: { children: React.ReactNode }) {
|
||
|
|
const theme = useThemeStore((s) => s.theme);
|
||
|
|
|
||
|
|
useEffect(() => {
|
||
|
|
document.documentElement.setAttribute('data-theme', theme);
|
||
|
|
}, [theme]);
|
||
|
|
|
||
|
|
return <>{children}</>;
|
||
|
|
}
|