Mailspring/app/internal_packages/draft-list/lib/sending-progress-bar.jsx
2018-01-23 17:35:09 -08:00

24 lines
751 B
JavaScript

const { React, PropTypes, Utils } = require('mailspring-exports');
class SendingProgressBar extends React.Component {
static propTypes = { progress: PropTypes.number.isRequired };
render() {
const otherProps = Utils.fastOmit(this.props, Object.keys(this.constructor.propTypes));
if (0 < this.props.progress && this.props.progress < 99) {
return (
<div className="sending-progress" {...otherProps}>
<div className="filled" style={{ width: `${Math.min(100, this.props.progress)}%` }} />
</div>
);
} else {
return (
<div className="sending-progress" {...otherProps}>
<div className="indeterminate" />
</div>
);
}
}
}
module.exports = SendingProgressBar;