Skip to content

Commit c3b5329

Browse files
committed
[Fix]: #2086 nav desktop app layout in publish mode
1 parent 8086c26 commit c3b5329

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

client/packages/lowcoder/src/comps/comps/layout/navLayout.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ const DEFAULT_WIDTH = 240;
4949
type MenuItemStyleOptionValue = "normal" | "hover" | "active";
5050
const EventOptions = [clickEvent] as const;
5151

52-
const StyledSide = styled(LayoutSider)`
53-
max-height: calc(100vh - ${TopHeaderHeight});
52+
const StyledSide = styled(LayoutSider)<{ $isPreview: boolean }>`
53+
max-height: ${(props) => (props.$isPreview ? `calc(100vh - ${TopHeaderHeight})` : "100vh")};
5454
overflow: auto;
5555
5656
.ant-menu-item:first-child {
@@ -199,6 +199,11 @@ const StyledMenu = styled(AntdMenu)<{
199199
200200
`;
201201

202+
203+
const ViewerMainContent = styled(MainContent)<{ $isPreview: boolean }>`
204+
height: ${(props) => (props.$isPreview ? `calc(100vh - ${TopHeaderHeight})` : "100vh")};
205+
`;
206+
202207
const StyledImage = styled.img`
203208
height: 1em;
204209
color: currentColor;
@@ -355,6 +360,7 @@ let NavTmpLayout = (function () {
355360
NavTmpLayout = withViewFn(NavTmpLayout, (comp) => {
356361
const pathParam = useAppPathParam();
357362
const isViewMode = isUserViewMode(pathParam);
363+
const isPreview = pathParam.viewMode === "preview";
358364
const [selectedKey, setSelectedKey] = useState("");
359365
const items = comp.children.items.getView();
360366
const navWidth = comp.children.width.getView();
@@ -674,25 +680,25 @@ NavTmpLayout = withViewFn(NavTmpLayout, (comp) => {
674680
);
675681

676682
let content = (
677-
<Layout>
683+
<Layout style={{ height: isPreview ? undefined : "100vh" }}>
678684
{(navPosition === 'top') && (
679685
<Header style={{ display: 'flex', alignItems: 'center', padding: 0 }}>
680686
{ navMenu }
681687
</Header>
682688
)}
683689
{(navPosition === 'left') && (
684-
<StyledSide theme="light" width={navWidth} collapsed={navCollapse}>
690+
<StyledSide $isPreview={isPreview} theme="light" width={navWidth} collapsed={navCollapse}>
685691
{navMenu}
686692
</StyledSide>
687693
)}
688-
<MainContent>{pageView}</MainContent>
694+
<ViewerMainContent $isPreview={isPreview}>{pageView}</ViewerMainContent>
689695
{(navPosition === 'bottom') && (
690696
<Footer style={{ display: 'flex', alignItems: 'center', padding: 0 }}>
691697
{ navMenu }
692698
</Footer>
693699
)}
694700
{(navPosition === 'right') && (
695-
<StyledSide theme="light" width={navWidth} collapsed={navCollapse}>
701+
<StyledSide $isPreview={isPreview} theme="light" width={navWidth} collapsed={navCollapse}>
696702
{navMenu}
697703
</StyledSide>
698704
)}

0 commit comments

Comments
 (0)