]>
cat aescling's git repositories - mastodon.git/blob - app/javascript/mastodon/components/attachment_list.js
1 import React
from 'react';
2 import ImmutablePropTypes
from 'react-immutable-proptypes';
3 import PropTypes
from 'prop-types';
4 import ImmutablePureComponent
from 'react-immutable-pure-component';
5 import Icon
from 'mastodon/components/icon';
7 const filename
= url
=> url
.split('/').pop().split('#')[0].split('?')[0];
9 export default class AttachmentList
extends ImmutablePureComponent
{
12 media: ImmutablePropTypes
.list
.isRequired
,
13 compact: PropTypes
.bool
,
17 const { media
, compact
} = this.props
;
21 <div className
='attachment-list compact'>
22 <ul className
='attachment-list__list'>
23 {media
.map(attachment
=> {
24 const displayUrl
= attachment
.get('remote_url') || attachment
.get('url');
27 <li key
={attachment
.get('id')}>
28 <a href
={displayUrl
} target
='_blank' rel
='noopener noreferrer'><Icon id
='link' /> {filename(displayUrl
)}</a
>
38 <div className
='attachment-list'>
39 <div className
='attachment-list__icon'>
43 <ul className
='attachment-list__list'>
44 {media
.map(attachment
=> {
45 const displayUrl
= attachment
.get('remote_url') || attachment
.get('url');
48 <li key
={attachment
.get('id')}>
49 <a href
={displayUrl
} target
='_blank' rel
='noopener noreferrer'>{filename(displayUrl
)}</a
>
This page took 0.099465 seconds and 4 git commands to generate.