The code powering m.abunchtell.com https://m.abunchtell.com
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
855 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. render () {
  6. const { media } = this.props;
  7. return (
  8. <div className='attachment-list'>
  9. <div className='attachment-list__icon'>
  10. <i className='fa fa-link' />
  11. </div>
  12. <ul className='attachment-list__list'>
  13. {media.map(attachment =>
  14. <li key={attachment.get('id')}>
  15. <a href={attachment.get('remote_url')} target='_blank' rel='noopener'>{filename(attachment.get('remote_url'))}</a>
  16. </li>
  17. )}
  18. </ul>
  19. </div>
  20. );
  21. }
  22. }
  23. AttachmentList.propTypes = {
  24. media: ImmutablePropTypes.list.isRequired
  25. };
  26. export default AttachmentList;