2017-05-03 09:04:16 +09:00
|
|
|
import React from 'react';
|
2017-04-19 22:37:18 +09:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
2017-05-31 09:14:26 +09:00
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
2017-04-19 22:37:18 +09:00
|
|
|
|
|
|
|
const filename = url => url.split('/').pop().split('#')[0].split('?')[0];
|
|
|
|
|
2017-06-24 02:36:54 +09:00
|
|
|
export default class AttachmentList extends ImmutablePureComponent {
|
2017-04-19 22:37:18 +09:00
|
|
|
|
2017-05-12 21:44:10 +09:00
|
|
|
static propTypes = {
|
2017-05-21 00:31:47 +09:00
|
|
|
media: ImmutablePropTypes.list.isRequired,
|
2017-05-12 21:44:10 +09:00
|
|
|
};
|
|
|
|
|
2017-04-19 22:37:18 +09:00
|
|
|
render () {
|
|
|
|
const { media } = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className='attachment-list'>
|
|
|
|
<div className='attachment-list__icon'>
|
|
|
|
<i className='fa fa-link' />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<ul className='attachment-list__list'>
|
|
|
|
{media.map(attachment =>
|
2018-01-19 00:13:07 +09:00
|
|
|
(<li key={attachment.get('id')}>
|
2017-04-19 22:37:18 +09:00
|
|
|
<a href={attachment.get('remote_url')} target='_blank' rel='noopener'>{filename(attachment.get('remote_url'))}</a>
|
2018-01-19 00:13:07 +09:00
|
|
|
</li>)
|
2017-04-19 22:37:18 +09:00
|
|
|
)}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-04-22 03:05:35 +09:00
|
|
|
|
2017-05-12 21:44:10 +09:00
|
|
|
}
|