Skip to content

Commit c106180

Browse files
committed
applied theme hook for styling
1 parent 9ad82c5 commit c106180

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

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

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ import { AutoHeightControl } from "comps/controls/autoHeightControl";
1717

1818
import { useContext } from "react";
1919
import { EditorContext } from "comps/editorState";
20+
import { useMergeCompStyles } from "@lowcoder-ee/index.sdk";
2021

2122
type IProps = DividerProps & {
2223
$style: DividerStyleType;
23-
dashed: boolean;
2424
$animationStyle:AnimationStyleType;
2525
};
2626

@@ -56,7 +56,6 @@ const StyledDivider = styled(Divider)<IProps>`
5656
.ant-divider-inner-text::before,
5757
.ant-divider-inner-text::after {
5858
border-block-start: ${(props) => props.$style.borderWidth && props.$style.borderWidth !== "0px" ? props.$style.borderWidth : "1px"}
59-
${(props) => props.dashed ? "dashed" : "solid"}
6059
${(props) => props.$style.border} !important;
6160
border-block-start-color: inherit;
6261
border-block-end: 0;
@@ -81,11 +80,10 @@ const StyledDivider = styled(Divider)<IProps>`
8180

8281
const childrenMap = {
8382
title: StringControl,
84-
dashed: BoolControl,
8583
align: alignControl(),
8684
autoHeight: withDefault(AutoHeightControl, "fixed"),
87-
style: styleControl(DividerStyle),
88-
animationStyle: styleControl(AnimationStyle),
85+
style: styleControl(DividerStyle , 'style'),
86+
animationStyle: styleControl(AnimationStyle , 'animationStyle'),
8987
};
9088

9189
function fixOldStyleData(oldData: any) {
@@ -104,12 +102,13 @@ function fixOldStyleData(oldData: any) {
104102

105103

106104
// Compatible with historical style data 2022-8-26
107-
const DividerTempComp = migrateOldData(
108-
new UICompBuilder(childrenMap, (props) => {
105+
export const DividerComp = migrateOldData(
106+
new UICompBuilder(childrenMap, (props , dispatch) => {
107+
useMergeCompStyles(props as Record<string, any>, dispatch);
108+
109109
return (
110110
<StyledDivider
111111
orientation={props.align}
112-
dashed={props.dashed}
113112
$style={props.style}
114113
$animationStyle={props.animationStyle}
115114
>
@@ -138,10 +137,9 @@ const DividerTempComp = migrateOldData(
138137
label: trans("divider.align"),
139138
radioButton: true,
140139
})}
141-
{children.autoHeight.getPropertyView()}
140+
{/* {children.autoHeight.getPropertyView()} */}
142141
</Section>
143142
<Section name={sectionNames.style}>
144-
{children.dashed.propertyView({ label: trans("divider.dashed") })}
145143
{children.style.getPropertyView()}
146144
</Section>
147145
<Section name={sectionNames.animationStyle}hasTooltip={true}>
@@ -153,7 +151,6 @@ const DividerTempComp = migrateOldData(
153151
);
154152
})
155153
.setExposeStateConfigs([
156-
new NameConfig("dashed", trans("divider.dashedDesc")),
157154
new NameConfig("title", trans("divider.titleDesc")),
158155
new NameConfig("align", trans("divider.alignDesc")),
159156
NameConfigHidden,
@@ -162,8 +159,9 @@ const DividerTempComp = migrateOldData(
162159
fixOldStyleData
163160
);
164161

165-
export const DividerComp = class extends DividerTempComp {
166-
override autoHeight(): boolean {
167-
return this.children.autoHeight.getView();
168-
}
169-
};
162+
// export const DividerComp
163+
// = class extends DividerTempComp {
164+
// override autoHeight(): boolean {
165+
// return this.children.autoHeight.getView();
166+
// }
167+
// };

client/packages/lowcoder/src/constants/themeConstants.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ const qrCode = {
9595
}
9696
};
9797

98+
const divider = {
99+
style: {
100+
radius: "0px"
101+
}
102+
};
98103

99104
export const defaultTheme: ThemeDetail = {
100105
primary: "#3377FF",
@@ -130,6 +135,7 @@ export const defaultTheme: ThemeDetail = {
130135
qrCode,
131136
treeSelect,
132137
pageLayout,
138+
divider,
133139
password: input,
134140
numberInput: input,
135141
textArea: input,

0 commit comments

Comments
 (0)