"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _react = _interopRequireDefault(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

require("./index.css");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var prefix = "titaui-dynamic-percent";

var DynamicPercent = function DynamicPercent(_ref) {
  var _classNames;

  var _ref$percent = _ref.percent,
      percent = _ref$percent === void 0 ? 0 : _ref$percent,
      _ref$growPercent = _ref.growPercent,
      growPercent = _ref$growPercent === void 0 ? 0 : _ref$growPercent,
      extraClass = _ref.extraClass;
  return /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])(extraClass, prefix)
  }, percent, "%", growPercent !== 0 && /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("".concat(prefix, "__grow"), (_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "__grow--increase"), growPercent > 0), _defineProperty(_classNames, "".concat(prefix, "__grow--decrease"), growPercent < 0), _classNames))
  }, /*#__PURE__*/_react["default"].createElement("i", {
    className: growPercent > 0 ? "tu-icon-simple-sort-up" : "tu-icon-simple-sort-down"
  }), Math.abs(growPercent), "%"));
};

var _default = DynamicPercent;
exports["default"] = _default;