1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4 |
|
5 | exports.__esModule = true;
|
6 | exports.useTheme = exports["default"] = void 0;
|
7 |
|
8 | var _core = require("@emotion/core");
|
9 |
|
10 | var _emotionTheming = require("emotion-theming");
|
11 |
|
12 | var _react = require("react");
|
13 |
|
14 | var _theme = _interopRequireDefault(require("../theme"));
|
15 |
|
16 |
|
17 | var ThemeProvider = function ThemeProvider(_ref) {
|
18 | var theme = _ref.theme,
|
19 | children = _ref.children;
|
20 | return (0, _core.jsx)(_emotionTheming.ThemeProvider, {
|
21 | theme: theme
|
22 | }, children);
|
23 | };
|
24 |
|
25 | ThemeProvider.defaultProps = {
|
26 | theme: _theme["default"]
|
27 | };
|
28 |
|
29 | var useTheme = function useTheme() {
|
30 | var theme = (0, _react.useContext)(_core.ThemeContext);
|
31 |
|
32 | if (theme === undefined) {
|
33 | throw new Error("useTheme must be used within a ThemeProvider");
|
34 | }
|
35 |
|
36 | return theme;
|
37 | };
|
38 |
|
39 | exports.useTheme = useTheme;
|
40 | var _default = ThemeProvider;
|
41 | exports["default"] = _default; |
\ | No newline at end of file |