UNPKG

react-dual-theme

Version:
22 lines 572 B
/** * @Author: Martin Adamko <martinadamko.sk@gmail.com> * @Date: 2019-10-13T13:10:01+02:00 * @Copyright: Martin Adamko * **/ import * as React from 'react'; import { ThemeContext } from './ThemeContext'; export function ThemeProvider({ children, theme }) { const light = typeof theme === 'string' ? theme : theme[0]; const dark = typeof theme === 'string' ? theme : theme[1]; const value = React.useMemo(() => [{ light, dark }], [light, dark]); return /*#__PURE__*/React.createElement(ThemeContext.Provider, { value: value }, children); }