Skip to content

Commit

Permalink
Added option to allow click handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
cchaos committed Feb 8, 2018
1 parent a373773 commit 38b12e6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src-docs/src/views/steps/steps_horizontal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const horizontalSteps = [
{
title: 'Completed Step 1',
isComplete: true,
onClick: () => window.alert('Step 1 clicked')
},
{
title: 'Selected Step 2',
Expand Down
5 changes: 5 additions & 0 deletions src/components/steps/_steps_horizontal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
}
}

// disabled state
&[disabled] {
cursor: not-allowed;
}

// create the connecting lines
position: relative;
&::before,
Expand Down
2 changes: 2 additions & 0 deletions src/components/steps/step_horizontal.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const EuiStepHorizontal = ({
title,
isSelected,
isComplete,
onClick,
disabled,
...rest
}) => {
Expand Down Expand Up @@ -49,6 +50,7 @@ export const EuiStepHorizontal = ({
aria-selected={!!isSelected}
type="button"
className={classes}
onClick={onClick}
disabled={disabled}
title={buttonTitle}
{...rest}
Expand Down
2 changes: 2 additions & 0 deletions src/components/steps/steps_horizontal.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function renderHorizontalSteps(steps) {
className,
disabled,
isSelected,
onClick,
...rest
} = step;

Expand All @@ -23,6 +24,7 @@ function renderHorizontalSteps(steps) {
step={index + 1}
disabled={disabled}
isSelected={isSelected}
onClick={onClick}
{...rest}
>
{children}
Expand Down
1 change: 1 addition & 0 deletions src/components/steps/steps_horizontal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const steps = [
{
title: 'Completed Step 1',
isComplete: true,
onClick: () => window.alert('Step 1 clicked'),
},
{
title: 'Selected Step 2',
Expand Down

0 comments on commit 38b12e6

Please sign in to comment.