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.
53 lines
1.4 KiB
53 lines
1.4 KiB
6 years ago
|
import React from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
2 years ago
|
import Motion from '../../ui/util/optional_motion';
|
||
6 years ago
|
import spring from 'react-motion/lib/spring';
|
||
|
import Icon from 'flavours/glitch/components/icon';
|
||
2 years ago
|
import { FormattedMessage } from 'react-intl';
|
||
6 years ago
|
|
||
|
export default class UploadProgress extends React.PureComponent {
|
||
|
|
||
|
static propTypes = {
|
||
|
active: PropTypes.bool,
|
||
|
progress: PropTypes.number,
|
||
2 years ago
|
isProcessing: PropTypes.bool,
|
||
6 years ago
|
};
|
||
|
|
||
|
render () {
|
||
2 years ago
|
const { active, progress, isProcessing } = this.props;
|
||
6 years ago
|
|
||
|
if (!active) {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
2 years ago
|
let message;
|
||
|
|
||
|
if (isProcessing) {
|
||
|
message = <FormattedMessage id='upload_progress.processing' defaultMessage='Processing…' />;
|
||
|
} else {
|
||
|
message = <FormattedMessage id='upload_progress.label' defaultMessage='Uploading…' />;
|
||
|
}
|
||
|
|
||
6 years ago
|
return (
|
||
2 years ago
|
<div className='upload-progress'>
|
||
|
<div className='upload-progress__icon'>
|
||
|
<Icon id='upload' />
|
||
|
</div>
|
||
6 years ago
|
|
||
2 years ago
|
<div className='upload-progress__message'>
|
||
5 years ago
|
{message}
|
||
6 years ago
|
|
||
2 years ago
|
<div className='upload-progress__backdrop'>
|
||
6 years ago
|
<Motion defaultStyle={{ width: 0 }} style={{ width: spring(progress) }}>
|
||
|
{({ width }) =>
|
||
2 years ago
|
<div className='upload-progress__tracker' style={{ width: `${width}%` }} />
|
||
6 years ago
|
}
|
||
|
</Motion>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
}
|