duration.tsx 504 B

1234567891011121314151617181920
  1. import * as React from 'react';
  2. import {getDuration, getExactDuration} from 'app/utils/formatters';
  3. type Props = React.HTMLProps<HTMLSpanElement> & {
  4. seconds: number;
  5. fixedDigits?: number;
  6. abbreviation?: boolean;
  7. exact?: boolean;
  8. };
  9. const Duration = ({seconds, fixedDigits, abbreviation, exact, ...props}: Props) => (
  10. <span {...props}>
  11. {exact
  12. ? getExactDuration(seconds, abbreviation)
  13. : getDuration(seconds, fixedDigits, abbreviation)}
  14. </span>
  15. );
  16. export default Duration;