@@ -20,6 +20,7 @@ import type { FC } from 'react';
2020type WithSidebarProps = {
2121 navKeys : Array < NavigationKeys > ;
2222 context ?: Record < string , RichTranslationValues > ;
23+ disableToggle ?: boolean ;
2324} ;
2425
2526type MappedItem = {
@@ -43,7 +44,12 @@ const mapItem = ([, item]: [string, MappedItem]): SidebarMappedEntry => ({
4344 items : item . items ? item . items . map ( mapItem ) : [ ] ,
4445} ) ;
4546
46- const WithSidebar : FC < WithSidebarProps > = ( { navKeys, context, ...props } ) => {
47+ const WithSidebar : FC < WithSidebarProps > = ( {
48+ navKeys,
49+ context,
50+ disableToggle = false ,
51+ ...props
52+ } ) => {
4753 const { getSideNavigation } = useSiteNavigation ( ) ;
4854 const pathname = usePathname ( ) ! ;
4955 const t = useTranslations ( ) ;
@@ -69,13 +75,13 @@ const WithSidebar: FC<WithSidebarProps> = ({ navKeys, context, ...props }) => {
6975 const hasNavigationContent =
7076 mappedSidebarItems . length > 0 && navKeys . length > 0 ;
7177
72- // If no navigation content, don't render sidebar or controls at all
78+ // If no navigation content, render empty div to preserve grid structure
7379 if ( ! hasNavigationContent ) {
74- return null ;
80+ return < div /> ;
7581 }
7682
77- // Show collapsed rail when sidebar is collapsed (only if there's content)
78- if ( isLeftSidebarCollapsed ) {
83+ // Show collapsed rail when sidebar is collapsed and toggle is enabled
84+ if ( isLeftSidebarCollapsed && ! disableToggle ) {
7985 return (
8086 < CollapsedSidebarRail side = "left" >
8187 < SidebarToggleButton
@@ -98,13 +104,15 @@ const WithSidebar: FC<WithSidebarProps> = ({ navKeys, context, ...props }) => {
98104 as = { Link }
99105 { ...props }
100106 >
101- < div className = "mb-6 flex justify-end pr-2" >
102- < SidebarToggleButton
103- side = "left"
104- isCollapsed = { isLeftSidebarCollapsed }
105- onToggle = { toggleLeftSidebar }
106- />
107- </ div >
107+ { ! disableToggle && (
108+ < div className = "mb-1 flex justify-end pr-2" >
109+ < SidebarToggleButton
110+ side = "left"
111+ isCollapsed = { isLeftSidebarCollapsed }
112+ onToggle = { toggleLeftSidebar }
113+ />
114+ </ div >
115+ ) }
108116 </ Sidebar >
109117 ) ;
110118} ;
0 commit comments