You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
854 B

  1. import React from 'react';
  2. import ImmutablePropTypes from 'react-immutable-proptypes';
  3. const filename = url => url.split('/').pop().split('#')[0].split('?')[0];
  4. class AttachmentList extends React.PureComponent {
  5. static propTypes = {
  6. media: ImmutablePropTypes.list.isRequired
  7. };
  8. render () {
  9. const { media } = this.props;
  10. return (
  11. <div className='attachment-list'>
  12. <div className='attachment-list__icon'>
  13. <i className='fa fa-link' />
  14. </div>
  15. <ul className='attachment-list__list'>
  16. {media.map(attachment =>
  17. <li key={attachment.get('id')}>
  18. <a href={attachment.get('remote_url')} target='_blank' rel='noopener'>{filename(attachment.get('remote_url'))}</a>
  19. </li>
  20. )}
  21. </ul>
  22. </div>
  23. );
  24. }
  25. }
  26. export default AttachmentList;