UNPKG

@blocktion/json-to-table

Version:

A powerful, modular React component for converting JSON data to navigable tables with advanced features like automatic column detection, theming, and sub-table navigation. Part of the Blocktion SaaS project ecosystem.

16 lines (15 loc) 620 B
import { jsx as _jsx } from "react/jsx-runtime"; import { createContext, useContext } from "react"; import { themes } from "./theme"; const ThemeContext = createContext(undefined); export const ThemeProvider = ({ children, theme = "default", }) => { const themeConfig = themes[theme]; return (_jsx(ThemeContext.Provider, { value: { theme: themeConfig, themeName: theme }, children: children })); }; export const useTheme = () => { const context = useContext(ThemeContext); if (context === undefined) { throw new Error("useTheme must be used within a ThemeProvider"); } return context; };