]> cat aescling's git repositories - mastodon.git/blob - app/javascript/mastodon/components/attachment_list.js
Improve eslint rules (#3147)
[mastodon.git] / app / javascript / mastodon / components / attachment_list.js
1 import React from 'react';
2 import ImmutablePropTypes from 'react-immutable-proptypes';
3
4 const filename = url => url.split('/').pop().split('#')[0].split('?')[0];
5
6 class AttachmentList extends React.PureComponent {
7
8 static propTypes = {
9 media: ImmutablePropTypes.list.isRequired,
10 };
11
12 render () {
13 const { media } = this.props;
14
15 return (
16 <div className='attachment-list'>
17 <div className='attachment-list__icon'>
18 <i className='fa fa-link' />
19 </div>
20
21 <ul className='attachment-list__list'>
22 {media.map(attachment =>
23 <li key={attachment.get('id')}>
24 <a href={attachment.get('remote_url')} target='_blank' rel='noopener'>{filename(attachment.get('remote_url'))}</a>
25 </li>
26 )}
27 </ul>
28 </div>
29 );
30 }
31
32 }
33
34 export default AttachmentList;
This page took 0.100966 seconds and 4 git commands to generate.