diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-03-08 04:54:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-08 04:54:26 +0100 |
commit | 86a9de6753fc425b247699c7822bc8a5d49af043 (patch) | |
tree | 0d90dd49c056e144ca7e9f24e2b161339ae90c35 /app/javascript/mastodon/components/attachment_list.js | |
parent | 83c982b4584b8fcbe75c670f15e562a3510a3804 (diff) |
Display AttachmentList in timelines in compact style when media missing (#6680)
Diffstat (limited to 'app/javascript/mastodon/components/attachment_list.js')
-rw-r--r-- | app/javascript/mastodon/components/attachment_list.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/app/javascript/mastodon/components/attachment_list.js b/app/javascript/mastodon/components/attachment_list.js index 9f2d46ddd..d8f90b5b6 100644 --- a/app/javascript/mastodon/components/attachment_list.js +++ b/app/javascript/mastodon/components/attachment_list.js @@ -1,5 +1,6 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; +import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; const filename = url => url.split('/').pop().split('#')[0].split('?')[0]; @@ -8,10 +9,25 @@ export default class AttachmentList extends ImmutablePureComponent { static propTypes = { media: ImmutablePropTypes.list.isRequired, + compact: PropTypes.bool, }; render () { - const { media } = this.props; + const { media, compact } = this.props; + + if (compact) { + return ( + <div className='attachment-list compact'> + <ul className='attachment-list__list'> + {media.map(attachment => ( + <li key={attachment.get('id')}> + <a href={attachment.get('remote_url')} target='_blank' rel='noopener'><i className='fa fa-link' /> {filename(attachment.get('remote_url'))}</a> + </li> + ))} + </ul> + </div> + ); + } return ( <div className='attachment-list'> |