UNPKG

@netdata/netdata-ui

Version:

netdata UI kit

51 lines (50 loc) 1.96 kB
"use strict"; exports.__esModule = true; exports["default"] = void 0; var getRadius = function getRadius(baseUnit, round) { if (round === true) return baseUnit + "px"; if (typeof round === "number") return baseUnit * round + "px"; if (typeof round === "string") return round; return ""; }; var topLeft = function topLeft(baseUnit, size) { return "border-top-left-radius: " + getRadius(baseUnit, size) + ";"; }; var topRight = function topRight(baseUnit, size) { return "border-top-right-radius: " + getRadius(baseUnit, size) + ";"; }; var bottomLeft = function bottomLeft(baseUnit, size) { return "border-bottom-left-radius: " + getRadius(baseUnit, size) + ";"; }; var bottomRight = function bottomRight(baseUnit, size) { return "border-bottom-right-radius: " + getRadius(baseUnit, size) + ";"; }; var radiusMap = { top: function top(baseUnit, size) { return "\n " + topLeft(baseUnit, size) + "\n " + topRight(baseUnit, size) + "\n "; }, left: function left(baseUnit, size) { return "\n " + topLeft(baseUnit, size) + "\n " + bottomLeft(baseUnit, size) + "\n "; }, bottom: function bottom(baseUnit, size) { return "\n " + bottomLeft(baseUnit, size) + "\n " + bottomRight(baseUnit, size) + "\n "; }, right: function right(baseUnit, size) { return "\n " + topRight(baseUnit, size) + "\n " + bottomRight(baseUnit, size) + "\n "; }, "top-left": topLeft, "top-right": topRight, "bottom-left": bottomLeft, "bottom-right": bottomRight }; var _default = exports["default"] = function _default(_ref) { var baseUnit = _ref.theme.constants.SIZE_SUB_UNIT, round = _ref.round; if (!round) return ""; var value = getRadius(baseUnit, round); if (value) return "border-radius: " + value + ";"; var side = round.side, _round$size = round.size, size = _round$size === void 0 ? 1 : _round$size; return side in radiusMap ? "" + radiusMap[side](baseUnit, size) : ""; };