1
1
import classNames from "classnames" ;
2
- import { PropsWithChildren , ReactNode } from "react" ;
2
+ import { MutableRefObject , PropsWithChildren , ReactNode } from "react" ;
3
3
import "../../../../styles/Layout/index.scss" ;
4
4
import { PanelSideBar } from "./PanelSideBar/PanelSidebar" ;
5
5
import { PanelSideBarLayoutContent } from "./PanelSideBarLayoutContent" ;
@@ -38,6 +38,11 @@ export interface PanelSideBarLayoutProps extends PropsWithChildren {
38
38
* If use the responsive layout when the screen is sm in order to remove the sidebar overlay.
39
39
*/
40
40
useResponsiveLayout ?: boolean ;
41
+
42
+ /**
43
+ * the main content body ref
44
+ */
45
+ mainContentBodyRef ?: MutableRefObject < HTMLElement | null > ;
41
46
}
42
47
43
48
export const PanelSideBarLayout = < TPanelItemId extends string , TPanelItem > ( props : PanelSideBarLayoutProps ) => {
@@ -50,6 +55,7 @@ export const PanelSideBarLayout = <TPanelItemId extends string, TPanelItem>(prop
50
55
collapsible = true ,
51
56
useToggleButton = false ,
52
57
useResponsiveLayout = false ,
58
+ mainContentBodyRef,
53
59
} = props ;
54
60
55
61
const { isSidebarOpen, toggleSidebar, renderFirstItemsLevelAsTiles } = usePanelSideBarContext < TPanelItemId , TPanelItem > ( ) ;
@@ -76,7 +82,9 @@ export const PanelSideBarLayout = <TPanelItemId extends string, TPanelItem>(prop
76
82
>
77
83
< PanelSideBar < TPanelItemId , TPanelItem > />
78
84
{ collapsible && ! useToggleButton && < PanelSideBarToggle onClick = { toggleSidebar } toggled = { ! isSidebarOpen } /> }
79
- < PanelSideBarLayoutContent footer = { footer } > { children } </ PanelSideBarLayoutContent >
85
+ < PanelSideBarLayoutContent footer = { footer } mainContentBodyRef = { mainContentBodyRef } >
86
+ { children }
87
+ </ PanelSideBarLayoutContent >
80
88
</ section >
81
89
</ >
82
90
) ;
0 commit comments