Files
Ubuntu 32b43f85bd a
2026-07-03 16:58:28 +08:00

17 lines
537 B
TypeScript

"use client";
import { useTheme } from "@/contexts/ThemeContext";
import { useEffect } from "react";
export default function ThemeWrapper({ children }: { children: React.ReactNode }) {
const { colorTheme, variant } = useTheme();
useEffect(() => {
const wrapper = document.querySelector(".theme-wrapper");
if (wrapper) {
wrapper.className = `theme-wrapper theme-${colorTheme} ${variant}`;
}
}, [colorTheme, variant]);
return <div className={`theme-wrapper theme-${colorTheme} ${variant}`}>{children}</div>;
}