@arche-mc2/arche-controls
Version:
We know that there are a ton of react UI library projects to choose from. Our hope with this one is to provide the next generation of react components that you can use to bootstrap your next project, or as a reference for building a UIKit. Read on to get
30 lines • 1.28 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = require("react");
var PropTypes = require("prop-types");
var withTheme = function (WrappedComponent) {
var _a;
return _a = (function (_super) {
tslib_1.__extends(ComponentWithTheme, _super);
function ComponentWithTheme(props, context) {
return _super.call(this, props, context) || this;
}
ComponentWithTheme.prototype.render = function () {
var theme = this.context.theme;
var _a = this.props, children = _a.children, others = tslib_1.__rest(_a, ["children"]);
return React.createElement(WrappedComponent, tslib_1.__assign({ theme: theme }, others), children);
};
return ComponentWithTheme;
}(React.Component)),
_a.displayName = "WithTheme(" + getDisplayName(WrappedComponent) + ")",
_a.contextTypes = {
theme: PropTypes.object
},
_a;
};
function getDisplayName(WrappedComponent) {
return WrappedComponent.displayName || WrappedComponent.name || 'Component';
}
exports.default = withTheme;
//# sourceMappingURL=withTheme.js.map