replayView.tsx 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import {Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import {Panel, PanelBody, PanelHeader as _PanelHeader} from 'sentry/components/panels';
  4. import {PlayerScrubber} from 'sentry/components/replays/player/scrubber';
  5. import ScrubberMouseTracking from 'sentry/components/replays/player/scrubberMouseTracking';
  6. import ReplayController from 'sentry/components/replays/replayController';
  7. import ReplayCurrentUrl from 'sentry/components/replays/replayCurrentUrl';
  8. import ReplayPlayer from 'sentry/components/replays/replayPlayer';
  9. import space from 'sentry/styles/space';
  10. type Props = {
  11. isFullscreen: boolean;
  12. toggleFullscreen: () => void;
  13. };
  14. function ReplayView({isFullscreen, toggleFullscreen}: Props) {
  15. return (
  16. <Fragment>
  17. <ReplayCurrentUrl />
  18. <PanelNoMargin isFullscreen={isFullscreen}>
  19. <PanelHeader disablePadding noBorder>
  20. <ReplayPlayer />
  21. </PanelHeader>
  22. <ScrubberMouseTracking>
  23. <PlayerScrubber />
  24. </ScrubberMouseTracking>
  25. </PanelNoMargin>
  26. <ReplayControllerWrapper>
  27. <ReplayController toggleFullscreen={toggleFullscreen} />
  28. </ReplayControllerWrapper>
  29. </Fragment>
  30. );
  31. }
  32. const ReplayControllerWrapper = styled(PanelBody)`
  33. padding-top: ${space(1)};
  34. `;
  35. const PanelNoMargin = styled(Panel)<{isFullscreen: boolean}>`
  36. margin-top: ${space(1)};
  37. margin-bottom: 0;
  38. height: 100%;
  39. display: grid;
  40. grid-template-rows: 1fr auto;
  41. `;
  42. const PanelHeader = styled(_PanelHeader)<{noBorder?: boolean}>`
  43. display: block;
  44. padding: 0;
  45. ${p => (p.noBorder ? 'border-bottom: none;' : '')}
  46. /*
  47. This style ensures that this PanelHeader grows and shrinks based on it's
  48. parent, not the content inside.
  49. The content inside will be set to height: 100% and then there's some code in
  50. there to measure the size in pixels. If this was normal overflow then measured
  51. size would never shrink.
  52. */
  53. overflow: hidden;
  54. `;
  55. export default ReplayView;