You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB

  1. import PureRenderMixin from 'react-addons-pure-render-mixin';
  2. import ImmutablePropTypes from 'react-immutable-proptypes';
  3. import IconButton from '../../../components/icon_button';
  4. const UploadForm = React.createClass({
  5. propTypes: {
  6. media: ImmutablePropTypes.list.isRequired,
  7. is_uploading: React.PropTypes.bool,
  8. onRemoveFile: React.PropTypes.func.isRequired
  9. },
  10. mixins: [PureRenderMixin],
  11. render () {
  12. const uploads = this.props.media.map(attachment => (
  13. <div key={attachment.get('id')} style={{ borderRadius: '4px', marginBottom: '10px' }} className='transparent-background'>
  14. <div style={{ width: '100%', height: '100px', borderRadius: '4px', background: `url(${attachment.get('preview_url')}) no-repeat center`, backgroundSize: 'cover' }}>
  15. <IconButton icon='times' title='Undo' size={36} onClick={this.props.onRemoveFile.bind(this, attachment.get('id'))} />
  16. </div>
  17. </div>
  18. ));
  19. return (
  20. <div style={{ marginBottom: '20px', padding: '10px', overflow: 'hidden' }}>
  21. {uploads}
  22. </div>
  23. );
  24. }
  25. });
  26. export default UploadForm;