@oxyhq/services
Version:
29 lines (28 loc) • 811 B
JavaScript
;
import React, { createContext, useContext } from 'react';
import { jsx as _jsx } from "react/jsx-runtime";
export const ThemeContext = /*#__PURE__*/createContext(undefined);
/**
* ThemeProvider component that accepts a theme prop and provides it via context.
* This allows Accounts-style components to access theme through hooks.
*/
export function ThemeProvider({
theme,
children
}) {
return /*#__PURE__*/_jsx(ThemeContext.Provider, {
value: {
resolvedTheme: theme,
isLoaded: true
},
children: children
});
}
export function useThemeContext() {
const context = useContext(ThemeContext);
if (context === undefined) {
throw new Error('useThemeContext must be used within a ThemeProvider');
}
return context;
}
//# sourceMappingURL=ThemeContext.js.map