onStepClick && onStepClick(step, index)}>
-
- {step.stepLabel}
-
- {step.stepDescription && (showDescriptionsForAllSteps || index === currentStepIndex) &&
- orientation !== ORIENTATION.VERTICAL &&
- labelPosition === LABEL_POSITION.TOP && (
+ steps,
+ completedNodeStyle,
+ currentNodeStyle
+}: IStepInfoProps) => {
+ const getNodeStyle = (): CSSProperties => {
+ const defaultStyles = getStyles(styles, Elements.Node, step, index) as CSSProperties;
+ const isCompleted = step.completed;
+ const isActive = index === currentStepIndex;
+
+ const getNodeStyles = (): NodeStyles => {
+ switch (true) {
+ case isCompleted:
+ return {
+ elementStyle: Elements.CompletedNode,
+ customStyle: completedNodeStyle
+ };
+ case isActive:
+ return {
+ elementStyle: Elements.ActiveNode,
+ customStyle: currentNodeStyle
+ };
+ default:
+ return {
+ elementStyle: Elements.InActiveNode,
+ customStyle: undefined
+ };
+ }
+ };
+
+ const { elementStyle, customStyle } = getNodeStyles();
+
+ return {
+ ...defaultStyles,
+ ...(getStyles(styles, elementStyle, step, index) as CSSProperties),
+ ...(customStyle || {})
+ };
+ };
+
+ return (
+
+ {!isInlineLabelsAndSteps && (
+
onStepClick && onStepClick(step, index)}>
- {step.stepDescription}
+ {step.stepLabel}
- )}
-
- )}
-
-
-
-
onStepClick && onStepClick(step, index)}
- showCursor={!!onStepClick}
- renderNode={renderNode}
- getStyles={(element: Elements): object =>
- getStyles(styles, element, step, index)
- }
+ {step.stepDescription && (showDescriptionsForAllSteps || index === currentStepIndex) &&
+ orientation !== ORIENTATION.VERTICAL &&
+ labelPosition === LABEL_POSITION.TOP && (
+
+ {step.stepDescription}
+
+ )}
+
+ )}
+
- {isInlineLabelsAndSteps && (
+ onStepClick && onStepClick(step, index)}
+ showCursor={!!onStepClick}
+ renderNode={renderNode}
+ getStyles={(element: Elements): object =>
+ getStyles(styles, element, step, index)
+ }
+ nodeStyle={getNodeStyle()}
+ />
+
+ {isInlineLabelsAndSteps && (
onStepClick && onStepClick(step, index)}
+ className={`labelContainer ${
+ [LABEL_POSITION.TOP, LABEL_POSITION.LEFT].includes(labelPosition)
+ ? "reversedLabelContainer"
+ : ""
+ }`}
>
- {step.stepLabel}
+
onStepClick && onStepClick(step, index)}
+ >
+ {step.stepLabel}
+
-
- )}
-
+ )}
+
+