Skip to content

Commit

Permalink
feat(progress-indicator): add vertical progress indicator to react
Browse files Browse the repository at this point in the history
  • Loading branch information
tw15egan committed Jan 22, 2020
1 parent 467deee commit 042db72
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,22 @@
display: block;
}

.#{$prefix}--progress--vertical .#{$prefix}--progress-step {
.#{$prefix}--progress--vertical .#{$prefix}--progress-step,
.#{$prefix}--progress--vertical .#{$prefix}--progress-step-button {
display: list-item;
min-height: 6rem;
width: initial;
min-width: initial;
}

svg {
display: inline-block;
margin: 0.1rem 0.5rem;
}
.#{$prefix}--progress--vertical .#{$prefix}--progress-step svg,
.#{$prefix}--progress--vertical .#{$prefix}--progress-step-button svg {
display: inline-block;
margin: 0.1rem 0.5rem;
}

.#{$prefix}--progress--vertical .#{$prefix}--progress-step-button svg {
margin-right: 0.7rem;
}

.#{$prefix}--progress--vertical .#{$prefix}--progress-step--current svg {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,73 @@ storiesOf('ProgressIndicator', module)
},
}
)
.add(
'Vertical',
() => (
<ProgressIndicator
vertical
currentIndex={number('Current progress (currentIndex)', 1)}>
<ProgressStep
label="First step"
description="Step 1: Getting started with Carbon Design System"
secondaryLabel="Optional label"
/>
<ProgressStep
label="Second step with tooltip"
description="Step 2: Getting started with Carbon Design System"
renderLabel={() => (
<Tooltip
direction="bottom"
showIcon={false}
triggerClassName={`${prefix}--progress-label`}
triggerText={'Second step with tooltip'}
tooltipId="tooltipId-0">
<p>Overflow tooltip content.</p>
</Tooltip>
)}
/>
<ProgressStep
label="Third step with tooltip"
description="Step 3: Getting started with Carbon Design System"
renderLabel={() => (
<Tooltip
direction="bottom"
showIcon={false}
triggerClassName={`${prefix}--progress-label`}
triggerText={'Third step with tooltip'}
tooltipId="tooltipId-1">
<p>
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Animi
consequuntur hic ratione aliquid cupiditate, nesciunt saepe iste
blanditiis cumque maxime tenetur veniam est illo deserunt sint
quae pariatur. Laboriosam, consequatur.
</p>
</Tooltip>
)}
/>
<ProgressStep
label="Fourth step"
description="Step 4: Getting started with Carbon Design System"
invalid
secondaryLabel="Example invalid step"
/>
<ProgressStep
label="Fifth step"
description="Step 5: Getting started with Carbon Design System"
disabled
/>
</ProgressIndicator>
),
{
info: {
text: `
For React usage, ProgressIndicator holds the currentIndex state to indicate which ProgressStep is the current step. The ProgressIndicator component should always be used with ProgressStep components as its children. Changing currentIndex prop will automatically set the ProgressStep components props (complete, incomplete, current).
For general usage, Progress Indicators display steps in a process. It should indicate when steps have been complete, the active step,
and the steps to come.
`,
},
}
)
.add(
'interactive',
() => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,10 @@ export class ProgressIndicator extends Component {
};

render() {
const { className, currentIndex, ...other } = this.props; // eslint-disable-line no-unused-vars
const { className, currentIndex, vertical, ...other } = this.props; // eslint-disable-line no-unused-vars
const classes = classnames({
[`${prefix}--progress`]: true,
[`${prefix}--progress--vertical`]: vertical,
[className]: className,
});
return (
Expand Down

0 comments on commit 042db72

Please sign in to comment.