diff options
author | Eugen <eugen@zeonfederated.com> | 2017-01-05 03:34:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-05 03:34:49 +0100 |
commit | 3b604d278602757350b769888dc3bf407887eff7 (patch) | |
tree | a6100862696e45f06cc4b1376fc854dac89da026 | |
parent | 879aa9ad268dca578fa33448480f6fa868ecba43 (diff) | |
parent | cbcb7e1241c4d0655ca7c6ad0840585d61e23e03 (diff) |
Merge pull request #395 from ticky/hide-media-list-if-no-media
Don't render the media list when there's no media
-rw-r--r-- | app/assets/javascripts/components/features/compose/components/upload_form.jsx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/assets/javascripts/components/features/compose/components/upload_form.jsx b/app/assets/javascripts/components/features/compose/components/upload_form.jsx index ac548033c..8a14dda69 100644 --- a/app/assets/javascripts/components/features/compose/components/upload_form.jsx +++ b/app/assets/javascripts/components/features/compose/components/upload_form.jsx @@ -18,9 +18,13 @@ const UploadForm = React.createClass({ mixins: [PureRenderMixin], render () { - const { intl } = this.props; + const { intl, media } = this.props; - const uploads = this.props.media.map(attachment => ( + if (!media.size) { + return null; + } + + const uploads = media.map(attachment => ( <div key={attachment.get('id')} style={{ borderRadius: '4px', marginBottom: '10px' }} className='transparent-background'> <div style={{ width: '100%', height: '100px', borderRadius: '4px', background: `url(${attachment.get('preview_url')}) no-repeat center`, backgroundSize: 'cover' }}> <IconButton icon='times' title={intl.formatMessage(messages.undo)} size={36} onClick={this.props.onRemoveFile.bind(this, attachment.get('id'))} /> @@ -29,7 +33,7 @@ const UploadForm = React.createClass({ )); return ( - <div style={{ marginBottom: '20px', padding: '10px', overflow: 'hidden' }}> + <div style={{ marginBottom: '20px', padding: '10px', overflow: 'hidden', flexShrink: '0' }}> {uploads} </div> ); |