G2GDataTransferStatusIcon.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import React, { type ComponentPropsWithoutRef } from 'react';
  2. import { G2G_PROGRESS_STATUS, type G2GProgressStatus } from '~/interfaces/g2g-transfer';
  3. /**
  4. * Props for {@link G2GDataTransferStatusIcon}
  5. */
  6. interface Props extends ComponentPropsWithoutRef<'i'>{
  7. status: G2GProgressStatus;
  8. }
  9. /**
  10. * Icon for G2G transfer status
  11. */
  12. const G2GDataTransferStatusIcon = ({ status, className, ...props }: Props): JSX.Element => {
  13. if (status === G2G_PROGRESS_STATUS.IN_PROGRESS) {
  14. return (
  15. <i className={`fa fa-spinner fa-pulse fa-fw ${className}`} aria-label="in progress" {...props} />
  16. );
  17. }
  18. if (status === G2G_PROGRESS_STATUS.COMPLETED) {
  19. return (
  20. <i className={`fa fa-check-circle-o fa-fw text-info ${className}`} aria-label="completed" {...props} />
  21. );
  22. }
  23. if (status === G2G_PROGRESS_STATUS.ERROR) {
  24. return (
  25. <i className={`fa fa-exclamation-circle fa-fw text-danger ${className}`} aria-label="error" {...props} />
  26. );
  27. }
  28. if (status === G2G_PROGRESS_STATUS.SKIPPED) {
  29. return (
  30. <i className={`fa fa-ban fa-fw ${className}`} aria-label="skipped" {...props} />
  31. );
  32. }
  33. return <i className={`fa fa-circle-o fa-fw ${className}`} aria-label="pending" {...props} />;
  34. };
  35. export default G2GDataTransferStatusIcon;