Skip to content

Commit

Permalink
update indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
jay-deshmukh committed Oct 1, 2024
1 parent 7cc0299 commit 22f26de
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/index.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/index.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/tyk-ui.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/tyk-ui.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/tyk-ui.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/tyk-ui.js.map

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions src/components/Stepper/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@

.error-step {
border: 1px solid var(--color-danger-dark);
border-radius: var(--form-control-border-radius);
padding: 5px;
color: var(--color-danger-dark);
}
}
4 changes: 3 additions & 1 deletion src/components/Stepper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ const Stepper = ({
error={error}
>
<StepIndicator
index={index}
isActive={index === currentStep}
currentStep={currentStep}
stepsLength={steps.length}
error={error}
index={index}
/>
</StepContent>
))}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Stepper/js/StepContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const StepContent = ({ step, index, currentStep, children, error }) => {
return (
<div className={getStepClassName()}>
{children}
<div className={`step-content ${error && isActive ? "error-step" : ""}`}>
<div className={`step-content`}>
<h3>{step.title}</h3>
<p>{step.description}</p>
{index === currentStep && <div>{error}</div>}
Expand Down
23 changes: 20 additions & 3 deletions src/components/Stepper/js/StepIndicator.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
import React from "react";
import Icon from "../../Icon";

const StepIndicator = ({ index, currentStep, stepsLength }) => {
const StepIndicator = ({
index,
currentStep,
stepsLength,
isActive,
error,
}) => {
const isStepComplete = index < currentStep;
const isShowStepLine = index < stepsLength - 1;
const isErroredStep = isActive && error;

return (
<div className="step-indicator">
<div className={`step-number`}>
{isStepComplete ? <Icon type="check" /> : index + 1}
<div
className={`step-number ${isStepComplete ? "completed" : ""} ${
isActive ? "active" : ""
} ${isErroredStep ? "error-step" : ""}`}
>
{isStepComplete ? (
<Icon type="check" />
) : isErroredStep ? (
<Icon type="exclamation" />
) : (
<span className="step-index">{index + 1}</span>
)}
</div>
{isShowStepLine && <div className="step-line"></div>}
</div>
Expand Down

0 comments on commit 22f26de

Please sign in to comment.