logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

upload_progress.js (1126B)


  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import Motion from '../../ui/util/optional_motion';
  4. import spring from 'react-motion/lib/spring';
  5. import { FormattedMessage } from 'react-intl';
  6. export default class UploadProgress extends React.PureComponent {
  7. static propTypes = {
  8. active: PropTypes.bool,
  9. progress: PropTypes.number,
  10. };
  11. render () {
  12. const { active, progress } = this.props;
  13. if (!active) {
  14. return null;
  15. }
  16. return (
  17. <div className='upload-progress'>
  18. <div className='upload-progress__icon'>
  19. <i className='fa fa-upload' />
  20. </div>
  21. <div className='upload-progress__message'>
  22. <FormattedMessage id='upload_progress.label' defaultMessage='Uploading...' />
  23. <div className='upload-progress__backdrop'>
  24. <Motion defaultStyle={{ width: 0 }} style={{ width: spring(progress) }}>
  25. {({ width }) =>
  26. <div className='upload-progress__tracker' style={{ width: `${width}%` }} />
  27. }
  28. </Motion>
  29. </div>
  30. </div>
  31. </div>
  32. );
  33. }
  34. }