import { Checkbox } from '@whalecloud/fdx';
import React from 'react';
import folder from '../../../../../../assets/imgs/folder.png';
import { contentCatgTypeMap } from '../const';
import './index.less';

function CommonSelPicCard(_ref) {
  var content = _ref.content,
      _onChange = _ref.onChange,
      checked = _ref.checked,
      type = _ref.type,
      onClick = _ref.onClick;

  var handleClick = function handleClick() {
    if (content.contentType === 'Catg') {
      onClick(content.contentId);
    }
  };

  return /*#__PURE__*/React.createElement("div", {
    className: "ant-upload-list ant-upload-list-picture-card"
  }, /*#__PURE__*/React.createElement("div", {
    className: "upload-list-item-container"
  }, /*#__PURE__*/React.createElement("span", null, content.contentType === 'Catg' ? /*#__PURE__*/React.createElement("div", {
    className: "upload-list-item folder",
    onClick: handleClick
  }, /*#__PURE__*/React.createElement("div", {
    className: "item-body"
  }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("div", {
    className: "ant-upload-list-item-thumbnail",
    href: ""
  }, /*#__PURE__*/React.createElement("img", {
    alt: "",
    style: {
      width: '100%',
      height: '100%'
    },
    src: folder
  })))), /*#__PURE__*/React.createElement("div", {
    className: "item-footer",
    title: content.contentTitle
  }, content.contentTitle)) : /*#__PURE__*/React.createElement("div", {
    className: "upload-list-item"
  }, /*#__PURE__*/React.createElement("div", {
    className: "item-body"
  }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("div", {
    className: "ant-upload-list-item-thumbnail",
    href: ""
  }, /*#__PURE__*/React.createElement("img", {
    alt: "",
    style: {
      width: '100%',
      height: '100%'
    },
    src: type === contentCatgTypeMap.PICTURE ? content.url : content.imgUrl
  }))), /*#__PURE__*/React.createElement("span", {
    style: {
      position: 'absolute',
      top: 4,
      right: 6
    }
  }, /*#__PURE__*/React.createElement(Checkbox, {
    className: "checkbox",
    checked: checked,
    onChange: function onChange(e) {
      return _onChange(e, content);
    }
  }))), /*#__PURE__*/React.createElement("div", {
    className: "item-footer",
    title: content.contentTitle
  }, content.contentTitle)))));
}

export default CommonSelPicCard;