UNPKG

@brizy/ui

Version:
47 lines (46 loc) 2.19 kB
"use strict"; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.LayoutSection = void 0; const react_1 = __importDefault(require("react")); const col_1 = __importDefault(require("antd/lib/col")); const responsiveProps = (prop, key, defaultProperty) => { const defaultProps = { lg: { [key]: defaultProperty, }, md: { [key]: defaultProperty, }, xs: { [key]: defaultProperty, }, }; const data = Array.isArray(prop) ? prop : [prop]; data.forEach((el, index) => { const device = index === 0 ? "lg" : index === 1 ? "md" : "xs"; defaultProps[device][key] = el || 0; }); return defaultProps; }; const LayoutSection = (_a) => { var { span = 24, push = 0, pull = 0, children } = _a, extra = __rest(_a, ["span", "push", "pull", "children"]); const spanResponsive = responsiveProps(span, "span", 24); const pushResponsive = responsiveProps(push, "push", 0); const pullResponsive = responsiveProps(pull, "pull", 0); return (react_1.default.createElement(col_1.default, Object.assign({ lg: Object.assign(Object.assign(Object.assign({}, spanResponsive["lg"]), pushResponsive["lg"]), pullResponsive["lg"]), md: Object.assign(Object.assign(Object.assign({}, spanResponsive["md"]), pushResponsive["md"]), pullResponsive["md"]), xs: Object.assign(Object.assign(Object.assign({}, spanResponsive["xs"]), pushResponsive["xs"]), pullResponsive["xs"]) }, extra), children)); }; exports.LayoutSection = LayoutSection;