@netdata/netdata-ui
Version:
netdata UI kit
42 lines (41 loc) • 971 B
JavaScript
;
exports.__esModule = true;
exports["default"] = void 0;
var getFlex = function getFlex(flex, basis) {
if (basis === void 0) {
basis = "auto";
}
if (flex === true) {
return "1 1 " + basis;
}
if (flex === false) {
return "0 0 " + basis;
}
if (flex === "grow") {
return "1 0 " + basis;
}
if (flex === "shrink") {
return "0 1 " + basis;
}
if (typeof flex === "number") {
return flex + " 0 " + basis;
}
if (typeof flex !== "object") {
return flex;
}
var grow = flex.grow,
shrink = flex.shrink;
return grow + " " + shrink + " " + basis;
};
var _default = exports["default"] = function _default(_ref) {
var flex = _ref.flex,
basis = _ref.basis;
if (flex === undefined && basis === undefined) {
return "";
}
if (basis && flex === undefined) {
return "flex-basis: " + basis + ";";
}
var flexValue = getFlex(flex, basis);
return flexValue ? "flex: " + flexValue + ";" : "";
};