Skip to content
This repository has been archived by the owner on May 20, 2019. It is now read-only.

Commit

Permalink
Added disabled steps
Browse files Browse the repository at this point in the history
  • Loading branch information
vpolotskiy committed Apr 23, 2017
1 parent d9df1ea commit 619d743
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions example/example.js
Expand Up @@ -23,7 +23,7 @@ class App extends Component {
console.log('onClick', 2)
}
}, {
title: 'Step Three',
title: 'Step Three (Disabled)',
href: 'http://example3.com',
onClick: (e) => {
e.preventDefault()
Expand Down Expand Up @@ -55,7 +55,7 @@ class App extends Component {

return (
<div>
<Stepper steps={ steps } activeStep={ currentStep } />
<Stepper steps={ steps } activeStep={ currentStep } disabledSteps={ [2] } />
<div style={ buttonStyle } onClick={ this.onClickNext }>Next</div>
</div>
);
Expand Down
5 changes: 3 additions & 2 deletions lib/Stepper.js
Expand Up @@ -30,6 +30,7 @@ var styles = {
function Stepper(_ref) {
var activeStep = _ref.activeStep,
steps = _ref.steps,
disabledSteps = _ref.disabledSteps,
activeColor = _ref.activeColor,
completeColor = _ref.completeColor,
defaultColor = _ref.defaultColor,
Expand All @@ -56,8 +57,8 @@ function Stepper(_ref) {
title: step.title,
href: step.href,
onClick: step.onClick,
active: index === activeStep,
completed: index < activeStep,
active: !(disabledSteps || []).includes(index) && index === activeStep,
completed: !(disabledSteps || []).includes(index) && index < activeStep,
first: index === 0,
isLast: index === steps.length - 1,
index: index,
Expand Down
6 changes: 3 additions & 3 deletions src/Stepper.js
Expand Up @@ -16,7 +16,7 @@ const styles = {
};

function Stepper({
activeStep, steps,
activeStep, steps, disabledSteps,
activeColor, completeColor, defaultColor, circleFontColor,
activeTitleColor, completeTitleColor, defaultTitleColor,
size, circleFontSize, titleFontSize,
Expand All @@ -32,8 +32,8 @@ function Stepper({
title={step.title}
href={step.href}
onClick={step.onClick}
active={index === activeStep}
completed={index < activeStep}
active={!(disabledSteps || []).includes(index) && index === activeStep}
completed={!(disabledSteps || []).includes(index) && index < activeStep}
first={index === 0}
isLast={index === steps.length - 1}
index={index}
Expand Down

0 comments on commit 619d743

Please sign in to comment.