timelinePosition.tsx 713 B

12345678910111213141516171819202122232425262728
  1. import React from 'react';
  2. import styled from '@emotion/styled';
  3. import * as Progress from 'sentry/components/replays/progress';
  4. import {divide} from 'sentry/components/replays/utils';
  5. import space from 'sentry/styles/space';
  6. type Props = {
  7. color: string;
  8. currentTime: number;
  9. duration: number | undefined;
  10. };
  11. function TimelinePosition({color, currentTime, duration}: Props) {
  12. const percentComplete = divide(currentTime, duration);
  13. return (
  14. <Progress.Meter>
  15. <Value color={color} percent={percentComplete} />
  16. </Progress.Meter>
  17. );
  18. }
  19. const Value = styled(Progress.Value)<Pick<Props, 'color'>>`
  20. border-right: ${space(0.25)} solid ${p => p.color};
  21. `;
  22. export default TimelinePosition;