Skip to content

Commit 9cc5c45

Browse files
Macraheeliftikhar5
Mac
authored andcommitted
card component
1 parent 727630a commit 9cc5c45

File tree

1 file changed

+24
-4
lines changed
  • client/packages/lowcoder/src/comps/comps/containerComp

1 file changed

+24
-4
lines changed

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

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ import { ButtonEventHandlerControl, CardEventHandlerControl, clickEvent, refresh
2020
import { optionsControl } from "comps/controls/optionsControl";
2121
import { dropdownControl } from "comps/controls/dropdownControl";
2222
import { styleControl } from "comps/controls/styleControl";
23+
import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext";
24+
import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext";
25+
import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil";
2326
const { Meta } = Card;
2427

2528
const Wrapper = styled.div<{
@@ -186,13 +189,30 @@ export const ContainerBaseComp = (function () {
186189
actionOptions: ActionOptionControl,
187190

188191
onEvent: CardEventHandlerControl,
189-
style: styleControl(CardStyle),
190-
headerStyle: styleControl(CardHeaderStyle),
191-
bodyStyle: styleControl(CardHeaderStyle),
192-
animationStyle: styleControl(AnimationStyle),
192+
style: styleControl(CardStyle , 'style'),
193+
headerStyle: styleControl(CardHeaderStyle , 'headerStyle'),
194+
bodyStyle: styleControl(CardHeaderStyle , 'bodyStyle'),
195+
animationStyle: styleControl(AnimationStyle , 'animationStyle'),
193196
};
194197

195198
return new ContainerCompBuilder(childrenMap, (props, dispatch) => {
199+
200+
const theme = useContext(ThemeContext);
201+
const compType = useContext(CompTypeContext);
202+
const compTheme = theme?.theme?.components?.[compType];
203+
const styleProps: Record<string, any> = {};
204+
['style', 'headerStyle', 'bodyStyle', 'animationStyle'].forEach((key: string) => {
205+
styleProps[key] = (props as any)[key];
206+
});
207+
208+
useEffect(() => {
209+
setInitialCompStyles({
210+
dispatch,
211+
compTheme,
212+
styleProps,
213+
});
214+
}, []);
215+
196216
props.container.showHeader = false;
197217
// 注入容器参数
198218
props.container.style = Object.assign(props.container.style, {

0 commit comments

Comments
 (0)