LabeledProgressBar.jsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { withTranslation } from 'react-i18next';
  4. import { Progress } from 'reactstrap';
  5. const LabeledProgressBar = (props) => {
  6. const {
  7. header, currentCount, totalCount, errorsCount, isInProgress,
  8. } = props;
  9. const progressingColor = isInProgress ? 'info' : 'success';
  10. return (
  11. <>
  12. <h6 className="my-1">
  13. {header}
  14. <div className="float-right">{currentCount} / {totalCount}</div>
  15. </h6>
  16. <Progress multi>
  17. <Progress bar max={totalCount} color={progressingColor} striped={isInProgress} animated={isInProgress} value={currentCount} />
  18. <Progress bar max={totalCount} color="danger" striped={isInProgress} animated={isInProgress} value={errorsCount} />
  19. </Progress>
  20. </>
  21. );
  22. };
  23. LabeledProgressBar.propTypes = {
  24. header: PropTypes.string.isRequired,
  25. currentCount: PropTypes.number.isRequired,
  26. totalCount: PropTypes.number.isRequired,
  27. errorsCount: PropTypes.number,
  28. isInProgress: PropTypes.bool,
  29. };
  30. export default withTranslation()(LabeledProgressBar);