From 1532cf7213ff026cea09984fb3563c105a477de0 Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Thu, 23 Jan 2020 15:47:31 -0800 Subject: [PATCH] feat(progress-indicator): add vertical progress indicator to react (#5146) --- .../_progress-indicator.scss | 23 ++++++++++++++----- .../ProgressIndicator-story.js | 5 ++-- .../ProgressIndicator/ProgressIndicator.js | 8 ++++++- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/packages/components/src/components/progress-indicator/_progress-indicator.scss b/packages/components/src/components/progress-indicator/_progress-indicator.scss index 12f9a5dda859..c9033a7dcbfb 100644 --- a/packages/components/src/components/progress-indicator/_progress-indicator.scss +++ b/packages/components/src/components/progress-indicator/_progress-indicator.scss @@ -226,15 +226,25 @@ } .#{$prefix}--progress--vertical .#{$prefix}--progress-step { + padding-bottom: rem(24px); + } + + .#{$prefix}--progress--vertical .#{$prefix}--progress-step, + .#{$prefix}--progress--vertical .#{$prefix}--progress-step-button { display: list-item; - min-height: 6rem; + min-height: 3.625rem; 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 { @@ -244,9 +254,10 @@ .#{$prefix}--progress--vertical .#{$prefix}--progress-label { display: inline-block; width: initial; - max-width: none; + max-width: rem(160px); vertical-align: top; margin: 0; + white-space: initial; } .#{$prefix}--progress--vertical .#{$prefix}--progress-step .bx--tooltip { diff --git a/packages/react/src/components/ProgressIndicator/ProgressIndicator-story.js b/packages/react/src/components/ProgressIndicator/ProgressIndicator-story.js index 24aa235a2718..84782662cadf 100644 --- a/packages/react/src/components/ProgressIndicator/ProgressIndicator-story.js +++ b/packages/react/src/components/ProgressIndicator/ProgressIndicator-story.js @@ -7,7 +7,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; -import { withKnobs, number } from '@storybook/addon-knobs'; +import { withKnobs, number, boolean, text } from '@storybook/addon-knobs'; import { action } from '@storybook/addon-actions'; import { ProgressIndicator, ProgressStep } from '../ProgressIndicator'; import ProgressIndicatorSkeleton from '../ProgressIndicator/ProgressIndicator.Skeleton'; @@ -22,9 +22,10 @@ storiesOf('ProgressIndicator', module) 'Default', () => ( diff --git a/packages/react/src/components/ProgressIndicator/ProgressIndicator.js b/packages/react/src/components/ProgressIndicator/ProgressIndicator.js index 647dffb63e10..4ffc3d7aa035 100644 --- a/packages/react/src/components/ProgressIndicator/ProgressIndicator.js +++ b/packages/react/src/components/ProgressIndicator/ProgressIndicator.js @@ -195,6 +195,11 @@ export class ProgressIndicator extends Component { * Optional callback called if a ProgressStep is clicked on. Returns the index of the step. */ onChange: PropTypes.func, + + /** + * Determines whether or not the ProgressIndicator should be rendered vertically. + */ + vertical: PropTypes.bool, }; static defaultProps = { @@ -243,9 +248,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 (