import React from 'react'; import hoistNonReactStatics from 'hoist-non-react-statics'; interface IThemeContextProps { theme: string; themePreferences?: { currentTheme: 'automatic' | 'light'; darkLevel: string; }; setTheme?: (newTheme?: {}) => void; } export const ThemeContext = React.createContext({ theme: 'light' }); export function withTheme

(Component: React.ComponentType

): (props: any) => JSX.Element { const ThemedComponent = (props: any) => ( {contexts => } ); hoistNonReactStatics(ThemedComponent, Component); return ThemedComponent; } export const useTheme = (): Partial => React.useContext(ThemeContext);