PageAttachmentList.js 834 B

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