@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
35 lines • 1.98 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = require("react");
var theming_1 = require("../../../Common/theming");
var styles_1 = require("./styles");
var withTheme_1 = require("../../../Common/theming/withTheme");
var classnames = require("classnames");
var UpGridContext_1 = require("./UpGridContext");
var UpGrid = function (_a) {
var _b = _a.gutter, gutter = _b === void 0 ? 0 : _b, _c = _a.fullRowLayout, fullRowLayout = _c === void 0 ? false : _c, _d = _a.rowSpacing, rowSpacing = _d === void 0 ? 0 : _d, _e = _a.type, type = _e === void 0 ? "flex" : _e, _f = _a.theme, theme = _f === void 0 ? theming_1.default : _f, rest = tslib_1.__rest(_a, ["gutter", "fullRowLayout", "rowSpacing", "type", "theme"]);
var children = rest.children, className = rest.className, style = rest.style;
var rows = children;
var _gutter = gutter != null ? gutter : (theme.gridGutter != null ? theme.gridGutter : 0);
var _rowSpacing = rowSpacing != null ? rowSpacing : (theme.gridRowSpacing != null ? theme.gridRowSpacing : 0);
if (_gutter > 0 || type != 'float') {
rows = React.Children.map(children, function (row) {
if (!row) {
return null;
}
if (row.props) {
return React.cloneElement(row, {
gutter: row.props.gutter == 0 ? _gutter : row.props.gutter,
type: row.props.type
});
}
return row;
});
}
return (React.createElement(UpGridContext_1.UpGridProvider, { value: { gutter: _gutter, rowSpacing: _rowSpacing, type: type, fullRowLayout: fullRowLayout } },
React.createElement("div", { style: style, className: classnames(className, styles_1.GridStyles) }, rows)));
};
exports.UpGrid = UpGrid;
exports.default = withTheme_1.default(UpGrid);
//# sourceMappingURL=UpGrid.js.map