]>
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';
6 const filename
= url
=> url
.split('/').pop().split('#')[0].split('?')[0];
8 export default class AttachmentList
extends ImmutablePureComponent
{
11 media: ImmutablePropTypes
.list
.isRequired
,
12 compact: PropTypes
.bool
,
16 const { media
, compact
} = this.props
;
20 <div className
='attachment-list compact'>
21 <ul className
='attachment-list__list'>
22 {media
.map(attachment
=> {
23 const displayUrl
= attachment
.get('remote_url') || attachment
.get('url');
26 <li key
={attachment
.get('id')}>
27 <a href
={displayUrl
} target
='_blank' rel
='noopener'><i className
='fa fa-link' /> {filename(displayUrl
)}</a
>
37 <div className
='attachment-list'>
38 <div className
='attachment-list__icon'>
39 <i className
='fa fa-link' />
42 <ul className
='attachment-list__list'>
43 {media
.map(attachment
=> {
44 const displayUrl
= attachment
.get('remote_url') || attachment
.get('url');
47 <li key
={attachment
.get('id')}>
48 <a href
={displayUrl
} target
='_blank' rel
='noopener'>{filename(displayUrl
)}</a
>
This page took 0.101806 seconds and 6 git commands to generate.