@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
25 lines • 1.51 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.marginProps = void 0;
var styled_components_1 = require("styled-components");
var getValue = function (value, theme) {
if (typeof value === 'string') {
return value;
}
if (theme && typeof theme.spacing === 'function') {
return theme.spacing(value);
}
return value;
};
var getStyleFor = function (property, value, theme) { return (value !== undefined ? property + ": " + getValue(value, theme) + ";" : ''); };
var marginProps = function (_a) {
var allMargin = _a.margin, marginTop = _a.marginTop, marginBottom = _a.marginBottom, marginLeft = _a.marginLeft, marginRight = _a.marginRight, theme = _a.theme;
return styled_components_1.css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n"], ["\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n"])), getStyleFor('margin', allMargin, theme), getStyleFor('margin-top', marginTop, theme), getStyleFor('margin-bottom', marginBottom, theme), getStyleFor('margin-left', marginLeft, theme), getStyleFor('margin-right', marginRight, theme));
};
exports.marginProps = marginProps;
var templateObject_1;
//# sourceMappingURL=marginProps.js.map