2017-04-21 21:05:35 +03:00
|
|
|
import PropTypes from 'prop-types';
|
2017-03-24 04:50:30 +02:00
|
|
|
import { Motion, spring } from 'react-motion';
|
|
|
|
import { FormattedMessage } from 'react-intl';
|
|
|
|
|
2017-04-21 21:05:35 +03:00
|
|
|
class UploadProgress extends React.PureComponent {
|
2017-03-24 04:50:30 +02:00
|
|
|
|
|
|
|
render () {
|
|
|
|
const { active, progress } = this.props;
|
|
|
|
|
|
|
|
if (!active) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className='upload-progress'>
|
|
|
|
<div>
|
|
|
|
<i className='fa fa-upload' />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div style={{ flex: '1 1 auto' }}>
|
|
|
|
<FormattedMessage id='upload_progress.label' defaultMessage='Uploading...' />
|
|
|
|
|
|
|
|
<div className='upload-progress__backdrop'>
|
|
|
|
<Motion defaultStyle={{ width: 0 }} style={{ width: spring(progress) }}>
|
|
|
|
{({ width }) =>
|
|
|
|
<div className='upload-progress__tracker' style={{ width: `${width}%` }} />
|
|
|
|
}
|
|
|
|
</Motion>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-04-21 21:05:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
UploadProgress.propTypes = {
|
|
|
|
active: PropTypes.bool,
|
|
|
|
progress: PropTypes.number
|
|
|
|
};
|
2017-03-24 04:50:30 +02:00
|
|
|
|
|
|
|
export default UploadProgress;
|