1 import type { HTMLAttributes, ReactNode, Ref } from 'react';
2 import { forwardRef } from 'react';
4 import clsx from '@proton/utils/clsx';
6 import { useTheme } from '../themes/ThemeProvider';
8 interface Props extends HTMLAttributes<HTMLDivElement> {
13 drawerSidebar?: ReactNode;
14 drawerVisibilityButton?: ReactNode;
15 isDrawerApp?: boolean;
16 mainBordered?: boolean;
19 const PrivateMainAreaBase = (
26 drawerVisibilityButton,
31 ref: Ref<HTMLDivElement>
33 const hasDrawerSidebar = !!drawerSidebar && !isDrawerApp;
34 const theme = useTheme();
35 const isProminent = theme.information.prominentHeader;
40 hasToolbar ? 'main-area--with-toolbar' : 'main-area',
41 hasRowMode ? 'main-area--row-mode' : undefined,
42 !drawerSidebar && !isProminent ? 'main-area-border' : undefined,
43 'flex-auto relative h-full reset4print outline-none--at-all',
52 'flex flex-nowrap w-full',
53 drawerSidebar ? 'h-full relative overflow-hidden' : undefined,
54 isProminent ? 'ui-prominent' : undefined
59 'flex flex-nowrap w-full h-full',
60 hasDrawerSidebar ? 'main-area-border overflow-hidden' : 'overflow-auto',
61 hasDrawerSidebar && mainBordered ? 'main-area-rounded--right' : undefined,
62 isProminent ? 'ui-standard main-area-rounded--left' : undefined
67 {drawerVisibilityButton}
74 const PrivateMainArea = forwardRef(PrivateMainAreaBase);
76 export default PrivateMainArea;