LabeledProgressBar.tsx 913 B

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