react-sleek
Version:
React Sleek Component Library
61 lines (60 loc) • 2.16 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var typestyle_1 = require("typestyle");
var Config_1 = require("../Config");
var Spacings_1 = require("../Style/Spacings");
var Theme_1 = require("../Style/Theme");
var csx_1 = require("csx");
var Dashboard = /** @class */ (function (_super) {
__extends(Dashboard, _super);
/**
* Default to dark theme
*/
function Dashboard(props) {
var _this = _super.call(this, props) || this;
// set theme
Config_1.default.setTheme(_this.props.theme);
return _this;
}
Dashboard.prototype.render = function () {
var theme = Theme_1.default(Config_1.default.getTheme());
var styleProps = {
backgroundColor: theme.Background,
color: theme.Text,
};
if (this.props.centerContent) {
styleProps.justifyContent = 'center';
styleProps.alignItems = 'center';
}
var dashboardThemeStyle = typestyle_1.style(styleProps);
return React.createElement("div", { className: typestyle_1.classes(styles.dashboardBase, dashboardThemeStyle) }, this.props.children);
};
Dashboard.defaultProps = {
centerContent: false,
};
return Dashboard;
}(React.PureComponent));
exports.default = Dashboard;
var styles = {
dashboardBase: typestyle_1.style({
display: 'flex',
flex: 1,
flexDirection: 'row',
boxSizing: 'border-box',
padding: csx_1.px(Spacings_1.default.Tight),
}),
};