import React from 'react';
import Img from "./Img";
import Uploading from "./../Uploading";
import Reload from "./Reload";
import Delete from "./Delete";
import RemainCount from "./RemainCount";

// 照片视频预览
var Item = function Item(_ref) {
  var remainCount = _ref.remainCount,
    item = _ref.item,
    index = _ref.index,
    uploading = _ref.uploading,
    onDelete = _ref.onDelete,
    onReUpload = _ref.onReUpload,
    onPreview = _ref.onPreview;
  return /*#__PURE__*/React.createElement("div", {
    "data-index": index
    // 状态status: choose|uploading|fail|success
    ,
    className: "image-item".concat(item.className ? ' ' + item.className : '').concat(item.status ? ' ' + item.status : ''),
    onClick: function onClick(e) {
      e.stopPropagation();
      onPreview && onPreview(e);
    }
  }, item.previewThumb || item.thumb ? /*#__PURE__*/React.createElement(Img, {
    src: item.previewThumb || item.thumb
  }) : null, /*#__PURE__*/React.createElement(Reload, {
    onClick: function onClick(e) {
      onReUpload && onReUpload(item, index);
    }
  }), /*#__PURE__*/React.createElement(Uploading, {
    uploading: uploading,
    item: item
  }), item.children, onDelete && /*#__PURE__*/React.createElement(Delete, {
    onClick: function onClick(e) {
      onDelete(item, index);
    }
  }), typeof remainCount === 'number' && remainCount > 0 ? /*#__PURE__*/React.createElement(RemainCount, {
    count: remainCount
  }) : null);
};
export default Item;