Skip to content

Commit 0c1c690

Browse files
committed
fix center icons on collapse + mount issue
1 parent 288fe92 commit 0c1c690

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

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

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import { EditorContainer, EmptyContent } from "pages/common/styledComponent";
1717
import { useCallback, useEffect, useMemo, useState } from "react";
1818
import styled from "styled-components";
1919
import { isUserViewMode, useAppPathParam } from "util/hooks";
20-
import { BoolCodeControl, StringControl, jsonControl } from "comps/controls/codeControl";
20+
import { StringControl, jsonControl } from "comps/controls/codeControl";
21+
import { BoolControl } from "comps/controls/boolControl";
2122
import { styleControl } from "comps/controls/styleControl";
2223
import {
2324
NavLayoutStyle,
@@ -40,7 +41,6 @@ import {
4041
menuItemStyleOptions
4142
} from "./navLayoutConstants";
4243
import { clickEvent, eventHandlerControl } from "@lowcoder-ee/comps/controls/eventHandlerControl";
43-
import { childrenToProps } from "@lowcoder-ee/comps/generators/multi";
4444
import { NavPosition, NavPositionOptions } from "./navLayoutConstants";
4545

4646
const { Header, Footer } = Layout;
@@ -141,6 +141,24 @@ const StyledMenu = styled(AntdMenu)<{
141141
}
142142
}
143143
144+
/* Collapse mode: hide label text and center icons */
145+
&.ant-menu-inline-collapsed {
146+
.ant-menu-title-content {
147+
display: none !important;
148+
}
149+
150+
> .ant-menu-item,
151+
> .ant-menu-submenu > .ant-menu-submenu-title {
152+
display: flex;
153+
justify-content: center;
154+
align-items: center;
155+
}
156+
157+
.anticon {
158+
line-height: 1 !important;
159+
}
160+
}
161+
144162
`;
145163

146164
const StyledImage = styled.img`
@@ -192,7 +210,7 @@ let NavTmpLayout = (function () {
192210
width: withDefault(StringControl, DEFAULT_WIDTH),
193211
backgroundImage: withDefault(StringControl, ""),
194212
position: dropdownControl(NavPositionOptions, NavPosition.Left),
195-
collapse: BoolCodeControl,
213+
collapse: BoolControl,
196214
navStyle: styleControl(NavLayoutStyle, 'navStyle'),
197215
navItemStyle: styleControl(NavLayoutItemStyle, 'navItemStyle'),
198216
navItemHoverStyle: styleControl(NavLayoutItemHoverStyle, 'navItemHoverStyle'),
@@ -672,13 +690,13 @@ NavTmpLayout = withDispatchHook(NavTmpLayout, (dispatch) => (action) => {
672690
});
673691
});
674692

675-
export const NavLayout = class extends NavTmpLayout {
693+
export class NavLayout extends NavTmpLayout {
676694
getAllCompItems() {
677695
return {};
678696
}
679697

680698
nameAndExposingInfo(): NameAndExposingInfo {
681699
return {};
682700
}
683-
};
701+
}
684702
registerLayoutMap({ compType: navLayoutCompType, comp: NavLayout });

0 commit comments

Comments
 (0)