"use strict";

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

var _fdx = require("@whalecloud/fdx");

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

var _currencyUtil = require("../../../utils/currencyUtil");

require("./index.less");

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

var ProductList = function ProductList(props) {
  var productList = props.productList,
      itemUp = props.itemUp,
      itemDown = props.itemDown,
      delImg = props.delImg;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "productList"
  }, productList.map(function (item, index) {
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "content",
      key: index
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "imgCot"
    }, /*#__PURE__*/_react["default"].createElement("img", {
      height: "72px",
      width: "72px",
      src: item.productImageUrl,
      alt: ""
    })), /*#__PURE__*/_react["default"].createElement("div", {
      className: "itemCot"
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "itemName"
    }, item.productName), /*#__PURE__*/_react["default"].createElement("div", {
      className: "itemPrice"
    }, (0, _currencyUtil.formatCurrencyWithSymbol)(item.salesPrice)), /*#__PURE__*/_react["default"].createElement("div", {
      className: "itemButton"
    }, /*#__PURE__*/_react["default"].createElement(_fdx.Button, {
      onClick: function onClick() {
        return itemUp(index);
      },
      disabled: index === 0 || productList.length === 1,
      style: {
        padding: '0 10px',
        height: '28px',
        marginBottom: '4px'
      }
    }, /*#__PURE__*/_react["default"].createElement(_fdx.Icon, {
      type: "arrow-up"
    })), /*#__PURE__*/_react["default"].createElement(_fdx.Button, {
      onClick: function onClick() {
        return itemDown(index);
      },
      disabled: index === productList.length - 1 || productList.length === 1,
      style: {
        padding: '0 10px',
        height: '28px'
      }
    }, /*#__PURE__*/_react["default"].createElement(_fdx.Icon, {
      type: "arrow-down"
    })), /*#__PURE__*/_react["default"].createElement(_fdx.Button, {
      onClick: function onClick() {
        return delImg(index);
      },
      style: {
        padding: '0 10px',
        height: '28px'
      }
    }, /*#__PURE__*/_react["default"].createElement(_fdx.Icon, {
      type: "delete"
    })))));
  }));
};

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