@@ -103,10 +103,12 @@ const BodyInnerGrid = styled(InnerGrid)<{
103
103
$bodyBackgroundImageSize : string ;
104
104
$bodyBackgroundImagePosition : string ;
105
105
$bodyBackgroundImageOrigin : string ;
106
+ $bodyPadding : string ;
106
107
} > `
107
108
border-top: ${ ( props ) => `${ props . $showBorder ? props . $borderWidth : 0 } solid ${ props . $borderColor } ` } ;
108
109
flex: 1;
109
110
border-radius: 0;
111
+ padding: ${ ( props ) => props . $bodyPadding || "0px" } !important;
110
112
111
113
${ props => getBackgroundStyle ( {
112
114
background : props . $backgroundColor ,
@@ -169,9 +171,18 @@ export function PageLayout(props: LayoutProps & { siderCollapsed: boolean; setSi
169
171
const isMobile = checkIsMobile ( maxWidth ) ;
170
172
const appRef = useRef ( ) ;
171
173
174
+ // Handle mobile responsiveness for sider collapse
175
+ useEffect ( ( ) => {
176
+ // Force collapse on mobile if sider is shown
177
+ if ( isMobile && showSider ) {
178
+ props . setSiderCollapsed ( true ) ;
179
+ }
180
+ } , [ isMobile , showSider , props . setSiderCollapsed ] ) ;
181
+
172
182
function onSiderCollapse ( collapsed : boolean ) {
173
183
props . setSiderCollapsed ( collapsed ) ;
174
- // how to set the collapsed state in the container when the user manually collapses the sider?
184
+ // We already updated the state through props.setSiderCollapsed
185
+ // The parent component will update the value via useEffect
175
186
}
176
187
177
188
useEffect ( ( ) => { setSiderCollapsed ( container . siderCollapsed ) } , [ container . siderCollapsed ] ) ;
@@ -196,7 +207,7 @@ export function PageLayout(props: LayoutProps & { siderCollapsed: boolean; setSi
196
207
< Sider
197
208
width = { container . siderWidth }
198
209
style = { { padding : "0px" , margin : '0px' , backgroundColor : siderStyle ?. siderBackground || 'transparent' } }
199
- collapsible = { container . siderCollapsible }
210
+ collapsible = { container . siderCollapsible && ! isMobile }
200
211
breakpoint = "sm"
201
212
collapsedWidth = { container . siderCollapsedWidth }
202
213
collapsed = { siderCollapsed } onCollapse = { ( value ) => onSiderCollapse ( value ) }
@@ -255,7 +266,7 @@ export function PageLayout(props: LayoutProps & { siderCollapsed: boolean; setSi
255
266
< Sider
256
267
width = { container . siderWidth }
257
268
style = { { padding : "0px" , margin : '0px' , marginTop : style . borderWidth , backgroundColor : siderStyle ?. siderBackground || 'transparent' } }
258
- collapsible = { container . siderCollapsible }
269
+ collapsible = { container . siderCollapsible && ! isMobile }
259
270
breakpoint = "sm"
260
271
collapsedWidth = { container . siderCollapsedWidth }
261
272
collapsed = { siderCollapsed } onCollapse = { ( value ) => setSiderCollapsed ( value ) }
@@ -312,7 +323,8 @@ export function PageLayout(props: LayoutProps & { siderCollapsed: boolean; setSi
312
323
$bodyBackgroundImageOrigin = { bodyStyle ?. backgroundImageOrigin }
313
324
$borderColor = { style ?. border }
314
325
$borderWidth = { style ?. borderWidth }
315
- style = { { padding : bodyStyle . containerBodyPadding } } />
326
+ $bodyPadding = { bodyStyle . containerBodyPadding }
327
+ style = { { padding : "0px" } } />
316
328
) }
317
329
</ ScrollBar >
318
330
</ Content >
@@ -321,7 +333,7 @@ export function PageLayout(props: LayoutProps & { siderCollapsed: boolean; setSi
321
333
< Sider
322
334
width = { container . siderWidth }
323
335
style = { { padding : "0px" , margin : '0px' , backgroundColor : siderStyle ?. siderBackground || 'transparent' } }
324
- collapsible = { container . siderCollapsible }
336
+ collapsible = { container . siderCollapsible && ! isMobile }
325
337
breakpoint = "sm"
326
338
collapsedWidth = { container . siderCollapsedWidth }
327
339
reverseArrow = { true }
@@ -381,7 +393,8 @@ export function PageLayout(props: LayoutProps & { siderCollapsed: boolean; setSi
381
393
$bodyBackgroundImageOrigin = { bodyStyle ?. backgroundImageOrigin }
382
394
$borderColor = { style ?. border }
383
395
$borderWidth = { style ?. borderWidth }
384
- style = { { padding : bodyStyle . containerBodyPadding } } />
396
+ $bodyPadding = { bodyStyle . containerBodyPadding }
397
+ style = { { padding : "0px" } } />
385
398
) }
386
399
</ ScrollBar >
387
400
</ Content >
@@ -416,7 +429,7 @@ export function PageLayout(props: LayoutProps & { siderCollapsed: boolean; setSi
416
429
< Sider
417
430
width = { container . siderWidth }
418
431
style = { { padding : "0px" , margin : '0px' , backgroundColor : siderStyle ?. siderBackground || 'transparent' } }
419
- collapsible = { container . siderCollapsible }
432
+ collapsible = { container . siderCollapsible && ! isMobile }
420
433
breakpoint = "sm"
421
434
collapsedWidth = { container . siderCollapsedWidth }
422
435
reverseArrow = { true }
0 commit comments