The code powering m.abunchtell.com https://m.abunchtell.com
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 

37 řádky
1.2 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. import { injectIntl } from 'react-intl';
  5. const UploadForm = React.createClass({
  6. propTypes: {
  7. media: ImmutablePropTypes.list.isRequired,
  8. is_uploading: React.PropTypes.bool,
  9. onRemoveFile: React.PropTypes.func.isRequired
  10. },
  11. mixins: [PureRenderMixin],
  12. render () {
  13. const { intl } = this.props;
  14. const uploads = this.props.media.map(attachment => (
  15. <div key={attachment.get('id')} style={{ borderRadius: '4px', marginBottom: '10px' }} className='transparent-background'>
  16. <div style={{ width: '100%', height: '100px', borderRadius: '4px', background: `url(${attachment.get('preview_url')}) no-repeat center`, backgroundSize: 'cover' }}>
  17. <IconButton icon='times' title={intl.formatMessage({ id: 'upload_form.undo', defaultMessage: 'Undo' })} size={36} onClick={this.props.onRemoveFile.bind(this, attachment.get('id'))} />
  18. </div>
  19. </div>
  20. ));
  21. return (
  22. <div style={{ marginBottom: '20px', padding: '10px', overflow: 'hidden' }}>
  23. {uploads}
  24. </div>
  25. );
  26. }
  27. });
  28. export default injectIntl(UploadForm);