Skip to content

Commit

Permalink
Theme: apply theme styles in timeline comp
Browse files Browse the repository at this point in the history
  • Loading branch information
raheeliftikhar5 committed Jun 16, 2024
1 parent c79fead commit 5e23e7b
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ import { timelineDate, timelineNode, TimelineDataTooltip } from "./timelineConst
import { convertTimeLineData } from "./timelineUtils";
import { default as Timeline } from "antd/es/timeline";
import { EditorContext } from "comps/editorState";
import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext";
import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext";
import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil";

const EventOptions = [
clickEvent,
Expand All @@ -64,7 +67,7 @@ const childrenMap = {
reverse: BoolControl,
pending: withDefault(StringControl, trans("timeLine.defaultPending")),
onEvent: eventHandlerControl(EventOptions),
style: styleControl(TimeLineStyle),
style: styleControl(TimeLineStyle, 'style'),
clickedObject: valueComp<timelineNode>({ title: "" }),
clickedIndex: valueComp<number>(0),
};
Expand All @@ -89,6 +92,22 @@ const TimelineComp = (
) => {
const { value, dispatch, style, mode, reverse, onEvent } = props;
const [icons, setIcons] = useState<React.ReactNode[]>([]);
const theme = useContext(ThemeContext);
const compType = useContext(CompTypeContext);
const compTheme = theme?.theme?.components?.[compType];

const styleProps: Record<string, any> = {};
['style'].forEach((key: string) => {
styleProps[key] = (props as any)[key];
});

useEffect(() => {
setInitialCompStyles({
dispatch,
compTheme,
styleProps,
});
}, []);

useEffect(() => {
const loadIcons = async () => {
Expand Down

0 comments on commit 5e23e7b

Please sign in to comment.