utils.tsx 624 B

12345678910111213141516171819202122
  1. import {LayoutKey} from 'sentry/utils/replays/hooks/useReplayLayout';
  2. import theme from 'sentry/utils/theme';
  3. export const getDefaultLayout = (collapsed: boolean): LayoutKey => {
  4. const {innerWidth, innerHeight} = window;
  5. const sidebarWidth = parseInt(
  6. collapsed ? theme.sidebar.collapsedWidth : theme.sidebar.expandedWidth,
  7. 10
  8. );
  9. const mediumScreenWidth = parseInt(theme.breakpoints.medium, 10);
  10. const windowsWidth =
  11. innerWidth <= mediumScreenWidth ? innerWidth : innerWidth - sidebarWidth;
  12. if (windowsWidth < innerHeight) {
  13. return LayoutKey.topbar;
  14. }
  15. return LayoutKey.sidebar_left;
  16. };