Item.jsx 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import React from 'react'
  2. import { Icon } from 'antd'
  3. export default (props) => {
  4. const { dataset = {}, onPreview, onDelete, onClick, onSticky } = props
  5. const { url } = dataset
  6. const handlePreview = () => {
  7. onPreview && onPreview(dataset)
  8. }
  9. const handleDelete = () => {
  10. onDelete && onDelete(dataset)
  11. }
  12. const handleClick = () => {
  13. return onClick ? onClick(dataset) : null
  14. }
  15. const handleSticky = () => {
  16. onSticky && onSticky(dataset)
  17. }
  18. return (
  19. <div className="ant-upload-list-picture-card-container">
  20. <span>
  21. <div className="ant-upload-list-item ant-upload-list-item-done ant-upload-list-item-list-type-picture-card">
  22. <div className="ant-upload-list-item-info">
  23. <span>
  24. <a className="ant-upload-list-item-thumbnail" href={url} target="_blank" rel="noopener noreferrer" onClick={handleClick}>
  25. <img className="ant-upload-list-item-image" src={url} alt="image" />
  26. </a>
  27. </span>
  28. </div>
  29. <span className="ant-upload-list-item-actions">
  30. <Icon type="vertical-align-top" className="anticon anticon-eye-o" onClick={handleSticky} />
  31. <Icon type="eye" className="anticon anticon-eye-o" onClick={handlePreview} />
  32. <Icon type="delete" onClick={handleDelete} />
  33. </span>
  34. </div>
  35. </span>
  36. </div>
  37. )
  38. }