@kalamazoo/theme
Version:
The Atlaskit theme framework
15 lines • 787 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var react_1 = tslib_1.__importDefault(require("react"));
var Theme_1 = tslib_1.__importDefault(require("./components/Theme"));
// Pre-executes the (global) theme and passes it as a prop to the supplied component.
// This is useful for ensuring that the current theme is accessible as props
// in styled-components.
function withTheme(InnerComponent) {
return function ComponentWithTheme(props) {
return (react_1.default.createElement(Theme_1.default.Consumer, null, function (tokens) { return (react_1.default.createElement(InnerComponent, tslib_1.__assign({}, props, { theme: tokens }))); }));
};
}
exports.withTheme = withTheme;
//# sourceMappingURL=hoc.js.map