PageAttachmentList.js 889 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* eslint-disable react/prop-types */
  2. import React from 'react';
  3. import Attachment from './Attachment';
  4. export default class PageAttachmentList extends React.Component {
  5. render() {
  6. if (this.props.attachments <= 0) {
  7. return null;
  8. }
  9. const attachmentList = this.props.attachments.map((attachment, idx) => {
  10. return (
  11. <Attachment
  12. key={`page:attachment:${attachment._id}`}
  13. attachment={attachment}
  14. inUse={this.props.inUse[attachment._id] || false}
  15. onAttachmentDeleteClicked={this.props.onAttachmentDeleteClicked}
  16. isUserLoggedIn={this.props.isUserLoggedIn}
  17. />
  18. );
  19. });
  20. return (
  21. <div>
  22. {(attachmentList.length !== 0)
  23. && <h5><strong>Attachments</strong></h5>
  24. }
  25. <ul className="pl-2">
  26. {attachmentList}
  27. </ul>
  28. </div>
  29. );
  30. }
  31. }