您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

TimeElapsed.tsx 824B

123456789101112131415161718192021222324252627282930313233343536
  1. import React from 'react';
  2. import { useTranslation } from 'react-i18next';
  3. import { createLocalizedTime } from '../timeFunctions';
  4. /**
  5. * The type of the React {@code Component} props of {@link TimeElapsed}.
  6. */
  7. interface IProps {
  8. /**
  9. * The milliseconds to be converted into a human-readable format.
  10. */
  11. time: number;
  12. }
  13. /**
  14. * React component for displaying total time elapsed. Converts a total count of
  15. * milliseconds into a more humanized form: "# hours, # minutes, # seconds".
  16. * With a time of 0, "0s" will be displayed.
  17. *
  18. * @augments Component
  19. */
  20. const TimeElapsed = ({ time }: IProps) => {
  21. const { t } = useTranslation();
  22. const timeElapsed = createLocalizedTime(time, t);
  23. return (
  24. <span>
  25. { timeElapsed }
  26. </span>
  27. );
  28. };
  29. export default TimeElapsed;