11import classNames from "classnames" ;
2- import { PropsWithChildren , ReactNode } from "react" ;
2+ import { MutableRefObject , PropsWithChildren , ReactNode } from "react" ;
33import "../../../../styles/Layout/index.scss" ;
44import { PanelSideBar } from "./PanelSideBar/PanelSidebar" ;
55import { PanelSideBarLayoutContent } from "./PanelSideBarLayoutContent" ;
@@ -38,6 +38,11 @@ export interface PanelSideBarLayoutProps extends PropsWithChildren {
3838 * If use the responsive layout when the screen is sm in order to remove the sidebar overlay.
3939 */
4040 useResponsiveLayout ?: boolean ;
41+
42+ /**
43+ * the main content body ref
44+ */
45+ mainContentBodyRef ?: MutableRefObject < HTMLElement | null > ;
4146}
4247
4348export const PanelSideBarLayout = < TPanelItemId extends string , TPanelItem > ( props : PanelSideBarLayoutProps ) => {
@@ -50,6 +55,7 @@ export const PanelSideBarLayout = <TPanelItemId extends string, TPanelItem>(prop
5055 collapsible = true ,
5156 useToggleButton = false ,
5257 useResponsiveLayout = false ,
58+ mainContentBodyRef,
5359 } = props ;
5460
5561 const { isSidebarOpen, toggleSidebar, renderFirstItemsLevelAsTiles } = usePanelSideBarContext < TPanelItemId , TPanelItem > ( ) ;
@@ -76,7 +82,9 @@ export const PanelSideBarLayout = <TPanelItemId extends string, TPanelItem>(prop
7682 >
7783 < PanelSideBar < TPanelItemId , TPanelItem > />
7884 { collapsible && ! useToggleButton && < PanelSideBarToggle onClick = { toggleSidebar } toggled = { ! isSidebarOpen } /> }
79- < PanelSideBarLayoutContent footer = { footer } > { children } </ PanelSideBarLayoutContent >
85+ < PanelSideBarLayoutContent footer = { footer } mainContentBodyRef = { mainContentBodyRef } >
86+ { children }
87+ </ PanelSideBarLayoutContent >
8088 </ section >
8189 </ >
8290 ) ;
0 commit comments