@gannochenko/ui.styled-components
Version:
<!-- PROJECT SHIELDS --> <!-- *** Reference links are enclosed in brackets [ ] instead of parentheses ( ). *** See the bottom of this document for the declaration of the reference variables *** for contributors-url, forks-url, etc. This is an optional, co
35 lines • 2.09 kB
JavaScript
;
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.contentAlignment = void 0;
var styled_components_1 = require("styled-components");
var replaceAlignment = function (how) {
if (how === 'start' || how === 'left' || how === 'top') {
return 'flex-start';
}
if (how === 'end' || how === 'right' || how === 'bottom') {
return 'flex-end';
}
if (how === 'middle') {
return 'center';
}
return how;
};
var contentAlignment = function (alignmentX, alignmentY, direction) {
if (direction === void 0) { direction = 'row'; }
var realAlignmentX = replaceAlignment(alignmentX);
var realAlignmentY = replaceAlignment(alignmentY);
if (direction === 'column' || direction === 'col') {
return styled_components_1.css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n ", "\n ", "\n "], ["\n display: flex;\n flex-direction: column;\n ",
"\n ", "\n "])), realAlignmentY !== null
? "justify-content: " + realAlignmentY + ";"
: '', realAlignmentX !== null ? "align-items: " + realAlignmentX + ";" : '');
}
return styled_components_1.css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n ", "\n ", "\n "], ["\n display: flex;\n flex-direction: row;\n ", "\n ", "\n "])), realAlignmentX !== null ? "justify-content: " + realAlignmentX + ";" : '', realAlignmentY !== null ? "align-items: " + realAlignmentY + ";" : '');
};
exports.contentAlignment = contentAlignment;
var templateObject_1, templateObject_2;
//# sourceMappingURL=contentAlignment.js.map