Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Stepper Component #388

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update indicators
jay-deshmukh committed Oct 1, 2024
commit 22f26de207fd61961c25007eb28fe7736ede2013
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
@@ -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
@@ -49,9 +49,11 @@ const Stepper = ({
error={error}
>
<StepIndicator
index={index}
isActive={index === currentStep}
currentStep={currentStep}
stepsLength={steps.length}
error={error}
index={index}
/>
</StepContent>
))}
2 changes: 1 addition & 1 deletion src/components/Stepper/js/StepContent.js
Original file line number Diff line number Diff line change
@@ -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>}
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>