@@ -4,7 +4,7 @@ import "../../../../styles/Layout/index.scss";
44import { PanelSideBar } from "./PanelSideBar/PanelSidebar" ;
55import { PanelSideBarLayoutContent } from "./PanelSideBarLayoutContent" ;
66import { PanelSideBarToggle } from "./PanelSideBar/PanelSideBarToggle" ;
7- import { PanelSidebarNavbar } from "./PanelSideBarNavbar" ;
7+ import { PanelSidebarNavbarInternal , PanelSidebarNavbarInternalProps } from "./PanelSideBarNavbar" ;
88import { usePanelSideBarContext } from "./PanelSideBar/Context/PanelSideBarContext" ;
99
1010export interface PanelSideBarLayoutProps extends PropsWithChildren {
@@ -38,8 +38,19 @@ 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+ * If true, exclude the sidebar menu.
44+ */
45+ excludeSibebarMenu ?: boolean ;
4146}
4247
48+ const PanelSidebarNavbar = ( props : Omit < PanelSidebarNavbarInternalProps , "toggleSidebar" | "theme" > ) => {
49+ const { toggleSidebar, theme } = usePanelSideBarContext ( ) ;
50+
51+ return < PanelSidebarNavbarInternal toggleSidebar = { toggleSidebar } theme = { theme } { ...props } /> ;
52+ } ;
53+
4354export const PanelSideBarLayout = < TPanelItemId extends string , TPanelItem > ( props : PanelSideBarLayoutProps ) => {
4455 const {
4556 brand,
@@ -50,6 +61,7 @@ export const PanelSideBarLayout = <TPanelItemId extends string, TPanelItem>(prop
5061 collapsible = true ,
5162 useToggleButton = false ,
5263 useResponsiveLayout = false ,
64+ excludeSibebarMenu = false ,
5365 } = props ;
5466
5567 const { isSidebarOpen, toggleSidebar, renderFirstItemsLevelAsTiles, menuItems, activePanelId } = usePanelSideBarContext <
@@ -83,15 +95,23 @@ export const PanelSideBarLayout = <TPanelItemId extends string, TPanelItem>(prop
8395 { "section-tiles" : renderFirstItemsLevelAsTiles } ,
8496 ) }
8597 >
86- < PanelSideBar < TPanelItemId , TPanelItem > isIconShownOnSidebarCollapse = { isIconShownOnSidebarCollapse } />
87- { collapsible && ! useToggleButton && (
88- < PanelSideBarToggle
89- onClick = { toggleSidebar }
90- toggled = { ! isSidebarOpen }
91- isIconShownOnSidebarCollapse = { isIconShownOnSidebarCollapse }
92- />
98+ { ! excludeSibebarMenu && (
99+ < >
100+ < PanelSideBar < TPanelItemId , TPanelItem > isIconShownOnSidebarCollapse = { isIconShownOnSidebarCollapse } />
101+ { collapsible && ! useToggleButton && (
102+ < PanelSideBarToggle
103+ onClick = { toggleSidebar }
104+ toggled = { ! isSidebarOpen }
105+ isIconShownOnSidebarCollapse = { isIconShownOnSidebarCollapse }
106+ />
107+ ) }
108+ </ >
93109 ) }
94- < PanelSideBarLayoutContent footer = { footer } isIconShownOnSidebarCollapse = { isIconShownOnSidebarCollapse } >
110+ < PanelSideBarLayoutContent
111+ excludeSibebarMenu = { excludeSibebarMenu }
112+ footer = { footer }
113+ isIconShownOnSidebarCollapse = { isIconShownOnSidebarCollapse }
114+ >
95115 { children }
96116 </ PanelSideBarLayoutContent >
97117 </ section >
0 commit comments