import React, { useMemo } from 'react';
import { locales } from '@pisell/utils';
import { PREFIX } from "../../status";
var Capacity = function Capacity(_ref) {
  var props = _ref.props;
  var dataSource = props.dataSource,
    skuTextConfig = props.skuTextConfig;
  var _ref2 = (skuTextConfig === null || skuTextConfig === void 0 ? void 0 : skuTextConfig.skuCapacityConfig) || {},
    isOpen = _ref2.isOpen,
    fontSize = _ref2.fontSize,
    fontWeight = _ref2.fontWeight,
    color = _ref2.color,
    customText = _ref2.customText;

  // 不开启
  if (!isOpen) return null;

  // 自定义文本
  if (customText) return customText;
  var finalStyle = useMemo(function () {
    return {
      fontSize: fontSize,
      fontWeight: fontWeight,
      color: color
    };
  }, [fontSize, fontWeight, color]);
  return /*#__PURE__*/React.createElement("div", {
    className: "".concat(PREFIX, "__card-capacity"),
    style: finalStyle
  }, locales.getText('pisell2.sku-card.capacity'), ":", ' ', (dataSource === null || dataSource === void 0 ? void 0 : dataSource.capacity) || 0);
};
export default Capacity;