Files
2024-02-15 17:01:50 +00:00

23 lines
624 B
TypeScript

import {LayoutKey} from 'sentry/utils/replays/hooks/useReplayLayout';
import theme from 'sentry/utils/theme';
export const getDefaultLayout = (collapsed: boolean): LayoutKey => {
const {innerWidth, innerHeight} = window;
const sidebarWidth = parseInt(
collapsed ? theme.sidebar.collapsedWidth : theme.sidebar.expandedWidth,
10
);
const mediumScreenWidth = parseInt(theme.breakpoints.medium, 10);
const windowsWidth =
innerWidth <= mediumScreenWidth ? innerWidth : innerWidth - sidebarWidth;
if (windowsWidth < innerHeight) {
return LayoutKey.TOPBAR;
}
return LayoutKey.SIDEBAR_LEFT;
};