durationCell.tsx 662 B

12345678910111213141516171819202122232425
  1. import Duration from 'sentry/components/duration';
  2. import {t} from 'sentry/locale';
  3. import {NumberContainer} from 'sentry/utils/discover/styles';
  4. type Props = {
  5. milliseconds: number;
  6. containerProps?: React.DetailedHTMLProps<
  7. React.HTMLAttributes<HTMLDivElement>,
  8. HTMLDivElement
  9. >;
  10. };
  11. export function DurationCell({milliseconds, containerProps}: Props) {
  12. const undefinedDurationText = `--${t('ms')}`;
  13. return (
  14. <NumberContainer {...containerProps}>
  15. {milliseconds >= 0 ? (
  16. <Duration seconds={milliseconds / 1000} fixedDigits={2} abbreviation />
  17. ) : (
  18. undefinedDurationText
  19. )}
  20. </NumberContainer>
  21. );
  22. }