UNPKG

react-life-design

Version:
82 lines 4.21 kB
"use strict"; var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; 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) t[p[i]] = s[p[i]]; return t; }; Object.defineProperty(exports, "__esModule", { value: true }); var React = require("react"); var styled_components_1 = require("styled-components"); var StyledGrid = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-block;\n\n .col {\n width: ", "%;\n float: left;\n padding: 0 17px;\n\n &:first-of-type { padding-left: 0; }\n\n &:last-of-type { padding-right: 0; }\n }\n"], ["\n display: inline-block;\n\n .col {\n width: ", "%;\n float: left;\n padding: 0 17px;\n\n &:first-of-type { padding-left: 0; }\n\n &:last-of-type { padding-right: 0; }\n }\n"])), function (props) { return (100 / props.columns); }); var Column = styled_components_1.default.div.attrs(function () { return ({ className: 'col', }); })(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n&.col {\n width: ", "%;\n\n @media screen and (max-width: 768px) {\n ", ";\n padding-right: ", ";\n padding-left: ", "\n }\n\n @media screen and (min-width: 768px) {\n ", ";\n width: ", "%;\n padding-right: ", ";\n padding-left: ", ";\n }\n\n @media screen and (min-width: 992px) {\n width: ", "%;\n padding-right: ", ";\n padding-left: ", ";\n }\n\n @media screen and (min-width: 1200px) {\n width: ", "%;\n padding-right: ", ";\n padding-left: ", ";\n }\n}\n"], ["\n&.col {\n width: ", "%;\n\n @media screen and (max-width: 768px) {\n ", ";\n padding-right: ", ";\n padding-left: ", "\n }\n\n @media screen and (min-width: 768px) {\n ", ";\n width: ", "%;\n padding-right: ", ";\n padding-left: ", ";\n }\n\n @media screen and (min-width: 992px) {\n width: ", "%;\n padding-right: ", ";\n padding-left: ", ";\n }\n\n @media screen and (min-width: 1200px) {\n width: ", "%;\n padding-right: ", ";\n padding-left: ", ";\n }\n}\n"])), function (_a) { var xs = _a.xs; return 100 / xs; }, function (_a) { var desktopOnly = _a.desktopOnly; return desktopOnly && "display: none"; }, function (_a) { var xs = _a.xs; return xs === 1 && "0"; }, function (_a) { var xs = _a.xs; return xs === 1 && "0"; }, function (_a) { var mobileOnly = _a.mobileOnly; return mobileOnly && "display: none"; }, function (_a) { var sm = _a.sm; return 100 / sm; }, function (_a) { var sm = _a.sm; return sm === 1 && "0"; }, function (_a) { var sm = _a.sm; return sm === 1 && "0"; }, function (_a) { var md = _a.md; return 100 / md; }, function (_a) { var md = _a.md; return md === 1 && "0"; }, function (_a) { var md = _a.md; return md === 1 && "0"; }, function (_a) { var lg = _a.lg; return 100 / lg; }, function (_a) { var lg = _a.lg; return lg === 1 && "0"; }, function (_a) { var lg = _a.lg; return lg === 1 && "0"; }); var Grid = function (_a) { var children = _a.children, rest = __rest(_a, ["children"]); return (React.createElement(StyledGrid, __assign({}, rest), children)); }; Grid.Column = Column; exports.default = Grid; var templateObject_1, templateObject_2; //# sourceMappingURL=Grid.js.map