PageAttachmentList.js 704 B

12345678910111213141516171819202122232425262728293031
  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. <ul>
  21. {attachmentList}
  22. </ul>
  23. );
  24. }
  25. }