Skip to content

Commit d841787

Browse files
committed
formating removed-48
1 parent a5304e1 commit d841787

File tree

1 file changed

+31
-46
lines changed
  • client/packages/lowcoder/src/comps/comps/navComp

1 file changed

+31
-46
lines changed

client/packages/lowcoder/src/comps/comps/navComp/navComp.tsx

Lines changed: 31 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { NameConfig, NameConfigHidden,withExposingConfigs } from "comps/generators/withExposing";
1+
import { NameConfig, NameConfigHidden, withExposingConfigs } from "comps/generators/withExposing";
22
import { UICompBuilder, withDefault } from "comps/generators";
33
import { Section, sectionNames } from "lowcoder-design";
44
import styled from "styled-components";
5-
import { clickEvent,eventHandlerControl } from "comps/controls/eventHandlerControl";
5+
import { clickEvent, eventHandlerControl } from "comps/controls/eventHandlerControl";
66
import { StringControl } from "comps/controls/codeControl";
77
import { alignWithJustifyControl } from "comps/controls/alignControl";
88
import { navListComp } from "./navItemComp";
@@ -37,15 +37,13 @@ const Wrapper = styled("div")<
3737
>`
3838
${props=>props.$animationStyle}
3939
height: 100%;
40-
border-radius: ${(props) =>
41-
props.$borderRadius ? props.$borderRadius : "2px"};
40+
border-radius: ${(props) => props.$borderRadius ? props.$borderRadius : '2px'};
4241
box-sizing: border-box;
43-
border: ${(props) => (props.$borderWidth ? `${props.$borderWidth}` : "1px")}
44-
solid ${(props) => props.$borderColor};
42+
border: ${(props) => props.$borderWidth ? `${props.$borderWidth}` : '1px'} solid ${(props) => props.$borderColor};
4543
background-color: ${(props) => props.$bgColor};
4644
`;
4745

48-
const NavInner = styled("div")<Pick<IProps, "$justify">>`
46+
const NavInner = styled("div") <Pick<IProps, "$justify">>`
4947
// margin: 0 -16px;
5048
height: 100%;
5149
display: flex;
@@ -62,23 +60,20 @@ const Item = styled.div<{
6260
$textSize: string;
6361
$margin: string;
6462
$padding: string;
65-
$textTransform: string;
66-
$textDecoration: string;
63+
$textTransform:string;
64+
$textDecoration:string;
6765
}>`
6866
height: 30px;
6967
line-height: 30px;
70-
padding: ${(props) => (props.$padding ? props.$padding : "0 16px")};
68+
padding: ${(props) => props.$padding ? props.$padding : '0 16px'};
7169
color: ${(props) => (props.$active ? props.$activeColor : props.$color)};
7270
font-weight: ${(props) => (props.$textWeight ? props.$textWeight : 500)};
73-
font-family: ${(props) =>
74-
props.$fontFamily ? props.$fontFamily : "sans-serif"};
75-
font-style: ${(props) => (props.$fontStyle ? props.$fontStyle : "normal")};
76-
font-size: ${(props) => (props.$textSize ? props.$textSize : "14px")};
77-
text-transform: ${(props) =>
78-
props.$textTransform ? props.$textTransform : ""};
79-
text-decoration: ${(props) =>
80-
props.$textDecoration ? props.$textDecoration : ""};
81-
margin: ${(props) => (props.$margin ? props.$margin : "0px")};
71+
font-family:${(props) => (props.$fontFamily ? props.$fontFamily : 'sans-serif')};
72+
font-style:${(props) => (props.$fontStyle ? props.$fontStyle : 'normal')};
73+
font-size:${(props) => (props.$textSize ? props.$textSize : '14px')};
74+
text-transform:${(props) => (props.$textTransform ? props.$textTransform : '')};
75+
text-decoration:${(props) => (props.$textDecoration ? props.$textDecoration : '')};
76+
margin:${(props) => props.$margin ? props.$margin : '0px'};
8277
8378
&:hover {
8479
color: ${(props) => props.$activeColor};
@@ -101,14 +96,14 @@ const LogoWrapper = styled.div`
10196
}
10297
`;
10398

104-
const ItemList = styled.div<{$align: string}>`
99+
const ItemList = styled.div<{ $align: string }>`
105100
flex: 1;
106101
display: flex;
107102
flex-direction: row;
108103
justify-content: ${(props) => props.$align};
109104
`;
110105

111-
const StyledMenu = styled(Menu)<MenuProps>`
106+
const StyledMenu = styled(Menu) <MenuProps>`
112107
&.ant-dropdown-menu {
113108
min-width: 160px;
114109
}
@@ -137,9 +132,7 @@ function fixOldStyleData(oldData: any) {
137132

138133
const childrenMap = {
139134
logoUrl: StringControl,
140-
logoEvent: withDefault(eventHandlerControl(logoEventHandlers), [
141-
{name: "click"},
142-
]),
135+
logoEvent: withDefault(eventHandlerControl(logoEventHandlers), [{ name: "click" }]),
143136
horizontalAlignment: alignWithJustifyControl(),
144137
style: migrateOldData(styleControl(NavigationStyle), fixOldStyleData),
145138
animationStyle: styleControl(AnimationStyle),
@@ -155,14 +148,12 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
155148
const items = (
156149
<>
157150
{data.map((menuItem, idx) => {
158-
const {hidden, label, items, active, onEvent} = menuItem.getView();
151+
const { hidden, label, items, active, onEvent } = menuItem.getView();
159152
if (hidden) {
160153
return null;
161154
}
162-
const visibleSubItems = items.filter(
163-
(item) => !item.children.hidden.getView()
164-
);
165-
const subMenuItems: Array<{key: string; label: string}> = [];
155+
const visibleSubItems = items.filter((item) => !item.children.hidden.getView());
156+
const subMenuItems: Array<{ key: string; label: string }> = [];
166157
const subMenuSelectedKeys: Array<string> = [];
167158
visibleSubItems.forEach((subItem, index) => {
168159
const key = index + "";
@@ -196,15 +187,18 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
196187
const subMenu = (
197188
<StyledMenu
198189
onClick={(e) => {
199-
const {onEvent: onSubEvent} = items[Number(e.key)]?.getView();
190+
const { onEvent: onSubEvent } = items[Number(e.key)]?.getView();
200191
onSubEvent("click");
201192
}}
202193
selectedKeys={subMenuSelectedKeys}
203194
items={subMenuItems}
204195
/>
205196
);
206197
return (
207-
<Dropdown key={idx} dropdownRender={() => subMenu}>
198+
<Dropdown
199+
key={idx}
200+
dropdownRender={() => subMenu}
201+
>
208202
{item}
209203
</Dropdown>
210204
);
@@ -230,11 +224,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
230224
<img src={props.logoUrl} alt="LOGO" />
231225
</LogoWrapper>
232226
)}
233-
{!justify ? (
234-
<ItemList $align={props.horizontalAlignment}>{items}</ItemList>
235-
) : (
236-
items
237-
)}
227+
{!justify ? <ItemList $align={props.horizontalAlignment}>{items}</ItemList> : items}
238228
</NavInner>
239229
</Wrapper>
240230
);
@@ -246,8 +236,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
246236
{menuPropertyView(children.items)}
247237
</Section>
248238

249-
{(useContext(EditorContext).editorModeStatus === "logic" ||
250-
useContext(EditorContext).editorModeStatus === "both") && (
239+
{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
251240
<Section name={sectionNames.interaction}>
252241
{hiddenPropertyView(children)}
253242
</Section>
@@ -264,15 +253,11 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
264253
</Section>
265254
)}
266255

267-
{(useContext(EditorContext).editorModeStatus === "logic" ||
268-
useContext(EditorContext).editorModeStatus === "both") && (
256+
257+
{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
269258
<Section name={sectionNames.advanced}>
270-
{children.logoUrl.propertyView({
271-
label: trans("navigation.logoURL"),
272-
tooltip: trans("navigation.logoURLDesc"),
273-
})}
274-
{children.logoUrl.getView() &&
275-
children.logoEvent.propertyView({inline: true})}
259+
{children.logoUrl.propertyView({ label: trans("navigation.logoURL"), tooltip: trans("navigation.logoURLDesc") })}
260+
{children.logoUrl.getView() && children.logoEvent.propertyView({ inline: true })}
276261
</Section>
277262
)}
278263

0 commit comments

Comments
 (0)