2017-12-24 07:16:45 +01:00
|
|
|
// Package imports.
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React from 'react';
|
|
|
|
import {
|
|
|
|
defineMessages,
|
|
|
|
FormattedMessage,
|
|
|
|
} from 'react-intl';
|
|
|
|
import spring from 'react-motion/lib/spring';
|
|
|
|
|
|
|
|
// Components.
|
|
|
|
import Icon from 'flavours/glitch/components/icon';
|
|
|
|
|
|
|
|
// Utils.
|
|
|
|
import Motion from 'flavours/glitch/util/optional_motion';
|
|
|
|
|
|
|
|
// Messages.
|
|
|
|
const messages = defineMessages({
|
|
|
|
upload: {
|
|
|
|
defaultMessage: 'Uploading...',
|
|
|
|
id: 'upload_progress.label',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
// The component.
|
|
|
|
export default function ComposerUploadFormProgress ({ progress }) {
|
|
|
|
|
|
|
|
// The result.
|
|
|
|
return (
|
|
|
|
<div className='composer--upload_form--progress'>
|
|
|
|
<Icon icon='upload' />
|
|
|
|
<div className='message'>
|
|
|
|
<FormattedMessage {...messages.upload} />
|
|
|
|
<div className='backdrop'>
|
|
|
|
<Motion
|
|
|
|
defaultStyle={{ width: 0 }}
|
|
|
|
style={{ width: spring(progress) }}
|
|
|
|
>
|
|
|
|
{({ width }) =>
|
2018-01-18 16:13:07 +01:00
|
|
|
(<div
|
2017-12-24 07:16:45 +01:00
|
|
|
className='tracker'
|
|
|
|
style={{ width: `${width}%` }}
|
2018-01-18 16:13:07 +01:00
|
|
|
/>)
|
2017-12-24 07:16:45 +01:00
|
|
|
}
|
|
|
|
</Motion>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Props.
|
|
|
|
ComposerUploadFormProgress.propTypes = { progress: PropTypes.number };
|