import React from 'react';
import { image } from '@pisell/utils';
import classNames from 'classnames';
import Decimal from 'decimal.js';
import PisellPriceText from "../../../../productSelect/components/pisellPriceText";
import "./index.less";
var ProductItem = function ProductItem(_ref) {
  var _ref$item = _ref.item,
    item = _ref$item === void 0 ? {} : _ref$item,
    _onClick = _ref.onClick,
    _ref$amountSymbol = _ref.amountSymbol,
    amountSymbol = _ref$amountSymbol === void 0 ? '$' : _ref$amountSymbol,
    style = _ref.style,
    className = _ref.className;
  var price = item.price,
    is_bundle = item.is_bundle,
    minimum_markup_price = item.minimum_markup_price;
  var _price = price;
  if (is_bundle) {
    _price = new Decimal(price).plus(new Decimal(minimum_markup_price)).toFixed(2);
  }
  return /*#__PURE__*/React.createElement("div", {
    style: style,
    className: classNames('product-item-card', className),
    onClick: function onClick() {
      _onClick(item);
    }
  }, item.cover ? /*#__PURE__*/React.createElement("img", {
    src: image.ali(item.cover, 100),
    className: "product-item-card-cover"
  }) : null, /*#__PURE__*/React.createElement("div", {
    className: "product-item-card-content"
  }, /*#__PURE__*/React.createElement("div", {
    className: "product-item-card-title"
  }, item.title), /*#__PURE__*/React.createElement("div", {
    className: "product-item-card-price"
  }, /*#__PURE__*/React.createElement(PisellPriceText, {
    value: _price,
    isMini: is_bundle
  }))));
};
export default ProductItem;