From 4fc4097a0db7af83b18c573ba01873b857ca577c Mon Sep 17 00:00:00 2001 From: Fernando Date: Wed, 6 Jan 2021 09:40:10 -0300 Subject: [PATCH] Update build dimensions --- index.js | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/index.js b/index.js index 247f7a8c7..d69888fbf 100644 --- a/index.js +++ b/index.js @@ -5419,9 +5419,9 @@ var parseDimension = function parseDimension(theme, _ref) { var height = _ref.height, width = _ref.width; var object = []; - var factor = 8; - isNaN(height) ? object.push("height: ".concat(height, ";")) : object.push("height: ".concat(factor * height, "px;")); - isNaN(width) ? object.push("width: ".concat(width, ";")) : object.push("width: ".concat(factor * width, "px;")); + var factor = theme.factors.dimensions; + height !== undefined && isNaN(height) ? object.push("height: ".concat(height, ";")) : object.push("height: ".concat(factor * height, "px;")); + width !== undefined && isNaN(width) ? object.push("width: ".concat(width, ";")) : object.push("width: ".concat(factor * width, "px;")); return object.join(''); }; @@ -5440,13 +5440,13 @@ var parseMargin = function parseMargin(theme, _ref) { mb = _ref.mb, ml = _ref.ml; var object = []; - var factor = 8; - isNaN(mx) ? object.push("\n margin-left: ".concat(mx, "; \n margin-right: ").concat(mx, ";")) : mx && object.push("\n margin-left: ".concat(factor * mx, "px; \n margin-right: ").concat(factor * mx, "px;\n ")); - isNaN(my) ? object.push("\n margin-top: ".concat(my, "; \n margin-bottom: ").concat(my, ";")) : my && object.push("\n margin-top: ".concat(factor * my, "px; \n margin-bottom: ").concat(factor * my, "px;\n ")); - isNaN(mt) ? object.push("\n margin-top: ".concat(mt, ";")) : mt && object.push("\n margin-top: ".concat(factor * mt, "px;\n ")); - isNaN(mr) ? object.push("\n margin-right: ".concat(mr, ";")) : mr && object.push("\n margin-right: ".concat(factor * mr, "px;\n ")); - isNaN(mb) ? object.push("\n margin-bottom: ".concat(mb, ";")) : mb && object.push("\n margin-bottom: ".concat(factor * mb, "px;\n ")); - isNaN(ml) ? object.push("\n margin-left: ".concat(ml, ";")) : ml && object.push("\n margin-left: ".concat(factor * ml, "px;\n ")); + var factor = theme.factors.margin; + mx !== undefined && isNaN(mx) ? object.push("\n margin-left: ".concat(mx, "; \n margin-right: ").concat(mx, ";")) : mx && object.push("\n margin-left: ".concat(factor * mx, "px; \n margin-right: ").concat(factor * mx, "px;\n ")); + my !== undefined && isNaN(my) ? object.push("\n margin-top: ".concat(my, "; \n margin-bottom: ").concat(my, ";")) : my && object.push("\n margin-top: ".concat(factor * my, "px; \n margin-bottom: ").concat(factor * my, "px;\n ")); + mt !== undefined && isNaN(mt) ? object.push("\n margin-top: ".concat(mt, ";")) : mt && object.push("\n margin-top: ".concat(factor * mt, "px;\n ")); + mr !== undefined && isNaN(mr) ? object.push("\n margin-right: ".concat(mr, ";")) : mr && object.push("\n margin-right: ".concat(factor * mr, "px;\n ")); + mb !== undefined && isNaN(mb) ? object.push("\n margin-bottom: ".concat(mb, ";")) : mb && object.push("\n margin-bottom: ".concat(factor * mb, "px;\n ")); + ml !== undefined && isNaN(ml) ? object.push("\n margin-left: ".concat(ml, ";")) : ml && object.push("\n margin-left: ".concat(factor * ml, "px;\n ")); return object.join(''); }; @@ -5458,13 +5458,13 @@ var parsePadding = function parsePadding(theme, _ref) { pb = _ref.pb, pl = _ref.pl; var object = []; - var factor = 8; - isNaN(px) ? object.push("\n padding-left: ".concat(px, "; \n padding-right: ").concat(px, ";\n ")) : px && object.push("\n padding-left: ".concat(factor * px, "px; \n padding-right: ").concat(factor * px, "px\n ;")); - isNaN(py) ? object.push("\n padding-top: ".concat(py, "; \n padding-bottom: ").concat(py, ";\n ")) : py && object.push("\n padding-top: ".concat(factor * py, "px; \n padding-bottom: ").concat(factor * py, "px\n ;")); - isNaN(pt) ? object.push("\n padding-top: ".concat(pt, ";\n ")) : pt && object.push("\n padding-top: ".concat(factor * pt, "px\n ;")); - isNaN(pr) ? object.push("\n padding-right: ".concat(pr, ";\n ")) : pr && object.push("\n padding-right: ".concat(factor * pr, "px\n ;")); - isNaN(pb) ? object.push("\n padding-bottom: ".concat(pb, ";\n ")) : pb && object.push("\n padding-bottom: ".concat(factor * pb, "px\n ;")); - isNaN(pl) ? object.push("\n padding-left: ".concat(pl, ";\n ")) : pl && object.push("\n padding-left: ".concat(factor * pl, "px\n ;")); + var factor = theme.factors.padding; + px !== undefined && isNaN(px) ? object.push("\n padding-left: ".concat(px, "; \n padding-right: ").concat(px, ";\n ")) : px && object.push("\n padding-left: ".concat(factor * px, "px; \n padding-right: ").concat(factor * px, "px\n ;")); + py !== undefined && isNaN(py) ? object.push("\n padding-top: ".concat(py, "; \n padding-bottom: ").concat(py, ";\n ")) : py && object.push("\n padding-top: ".concat(factor * py, "px; \n padding-bottom: ").concat(factor * py, "px\n ;")); + pt !== undefined && isNaN(pt) ? object.push("\n padding-top: ".concat(pt, ";\n ")) : pt && object.push("\n padding-top: ".concat(factor * pt, "px\n ;")); + pr !== undefined && isNaN(pr) ? object.push("\n padding-right: ".concat(pr, ";\n ")) : pr && object.push("\n padding-right: ".concat(factor * pr, "px\n ;")); + pb !== undefined && isNaN(pb) ? object.push("\n padding-bottom: ".concat(pb, ";\n ")) : pb && object.push("\n padding-bottom: ".concat(factor * pb, "px\n ;")); + pl !== undefined && isNaN(pl) ? object.push("\n padding-left: ".concat(pl, ";\n ")) : pl && object.push("\n padding-left: ".concat(factor * pl, "px\n ;")); return object.join(''); }; @@ -5537,6 +5537,11 @@ var theme = { primary: 'PT Sans', secondary: 'Nunito Sans' }, + factors: { + dimensions: 10, + padding: 8, + margin: 8 + }, parseAlign: parseAlign, parseBgColor: parseBgColor, parseCustom: parseCustom,