UNPKG

@teamsparta/stack-core

Version:
42 lines (38 loc) 986 B
"use client"; import { generateThemeStyles } from "./chunk-6THON44W.mjs"; // src/theme/StackThemeProvider.tsx import { createContext } from "@teamsparta/stack-utils"; import { jsx, jsxs } from "react/jsx-runtime"; var [ /** * @description * @example */ ThemeContextProvider, useThemeContext ] = createContext("ThemeContextProvider", { theme: "sccLight" }); function StackThemeProvider({ children, theme: modeFromProps }) { const { theme: modeFromContext } = useThemeContext("StackThemeProvider"); const theme = modeFromProps != null ? modeFromProps : modeFromContext; return /* @__PURE__ */ jsxs(ThemeContextProvider, { theme, children: [ /* @__PURE__ */ jsx( "style", { suppressHydrationWarning: true, dangerouslySetInnerHTML: { __html: generateThemeStyles(theme) } } ), /* @__PURE__ */ jsx("div", { "data-stack-color-theme": theme, children }) ] }); } export { useThemeContext, StackThemeProvider };