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.

42 lines
1.1 KiB

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