Skip to content

Commit 520bfca

Browse files
Merge pull request #1688 from iamfaran/fix/1497-page-issues
[FIX]: #1497 Page Layout Sider and Body Padding Issues
2 parents 3f71caa + c11333e commit 520bfca

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

client/packages/lowcoder/src/comps/comps/containerComp/pageLayoutComp.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,8 @@ export const PageLayoutComp = withMethodExposing(PageLayoutCompTmP, [
141141
params: [{ name: "collapsed", type: "boolean" }],
142142
},
143143
execute: (comp, values) => {
144-
const page = values[0] as number;
145-
if (page && page > 0) {
146-
// comp.children.pagination.children.pageNo.dispatchChangeValueAction(page);
147-
}
144+
const collapsed = !!values[0]; // Ensure boolean value
145+
comp.children.container.children.siderCollapsed.dispatchChangeValueAction(collapsed);
148146
},
149147
}
150148
]);

client/packages/lowcoder/src/comps/comps/pageLayoutComp/pageLayout.tsx

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,12 @@ const BodyInnerGrid = styled(InnerGrid)<{
103103
$bodyBackgroundImageSize: string;
104104
$bodyBackgroundImagePosition: string;
105105
$bodyBackgroundImageOrigin: string;
106+
$bodyPadding: string;
106107
}>`
107108
border-top: ${(props) => `${props.$showBorder ? props.$borderWidth : 0} solid ${props.$borderColor}`};
108109
flex: 1;
109110
border-radius: 0;
111+
padding: ${(props) => props.$bodyPadding || "0px"} !important;
110112
111113
${props => getBackgroundStyle({
112114
background: props.$backgroundColor,
@@ -169,9 +171,18 @@ export function PageLayout(props: LayoutProps & { siderCollapsed: boolean; setSi
169171
const isMobile = checkIsMobile(maxWidth);
170172
const appRef = useRef();
171173

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+
172182
function onSiderCollapse (collapsed : boolean) {
173183
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
175186
}
176187

177188
useEffect(() => {setSiderCollapsed(container.siderCollapsed)} , [container.siderCollapsed]);
@@ -196,7 +207,7 @@ export function PageLayout(props: LayoutProps & { siderCollapsed: boolean; setSi
196207
<Sider
197208
width={container.siderWidth}
198209
style={{ padding: "0px", margin: '0px', backgroundColor: siderStyle?.siderBackground || 'transparent' }}
199-
collapsible={container.siderCollapsible}
210+
collapsible={container.siderCollapsible && !isMobile}
200211
breakpoint="sm"
201212
collapsedWidth={container.siderCollapsedWidth}
202213
collapsed={siderCollapsed} onCollapse={(value) => onSiderCollapse(value)}
@@ -255,7 +266,7 @@ export function PageLayout(props: LayoutProps & { siderCollapsed: boolean; setSi
255266
<Sider
256267
width={container.siderWidth}
257268
style={{ padding: "0px", margin: '0px', marginTop: style.borderWidth, backgroundColor: siderStyle?.siderBackground || 'transparent' }}
258-
collapsible={container.siderCollapsible}
269+
collapsible={container.siderCollapsible && !isMobile}
259270
breakpoint="sm"
260271
collapsedWidth={container.siderCollapsedWidth}
261272
collapsed={siderCollapsed} onCollapse={(value) => setSiderCollapsed(value)}
@@ -312,7 +323,8 @@ export function PageLayout(props: LayoutProps & { siderCollapsed: boolean; setSi
312323
$bodyBackgroundImageOrigin={bodyStyle?.backgroundImageOrigin}
313324
$borderColor={style?.border}
314325
$borderWidth={style?.borderWidth}
315-
style={{ padding: bodyStyle.containerBodyPadding }} />
326+
$bodyPadding={bodyStyle.containerBodyPadding}
327+
style={{ padding: "0px" }} />
316328
)}
317329
</ScrollBar>
318330
</Content>
@@ -321,7 +333,7 @@ export function PageLayout(props: LayoutProps & { siderCollapsed: boolean; setSi
321333
<Sider
322334
width={container.siderWidth}
323335
style={{ padding: "0px", margin: '0px', backgroundColor: siderStyle?.siderBackground || 'transparent' }}
324-
collapsible={container.siderCollapsible}
336+
collapsible={container.siderCollapsible && !isMobile}
325337
breakpoint="sm"
326338
collapsedWidth={container.siderCollapsedWidth}
327339
reverseArrow={true}
@@ -381,7 +393,8 @@ export function PageLayout(props: LayoutProps & { siderCollapsed: boolean; setSi
381393
$bodyBackgroundImageOrigin={bodyStyle?.backgroundImageOrigin}
382394
$borderColor={style?.border}
383395
$borderWidth={style?.borderWidth}
384-
style={{ padding: bodyStyle.containerBodyPadding }} />
396+
$bodyPadding={bodyStyle.containerBodyPadding}
397+
style={{ padding: "0px" }} />
385398
)}
386399
</ScrollBar>
387400
</Content>
@@ -416,7 +429,7 @@ export function PageLayout(props: LayoutProps & { siderCollapsed: boolean; setSi
416429
<Sider
417430
width={container.siderWidth}
418431
style={{ padding: "0px", margin: '0px', backgroundColor: siderStyle?.siderBackground || 'transparent'}}
419-
collapsible={container.siderCollapsible}
432+
collapsible={container.siderCollapsible && !isMobile}
420433
breakpoint="sm"
421434
collapsedWidth={container.siderCollapsedWidth}
422435
reverseArrow={true}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy