Skip to content

Commit

Permalink
fix(PageWizard): add stepWidth prop support
Browse files Browse the repository at this point in the history
fixes: #3836
  • Loading branch information
herleraja committed Jan 8, 2024
1 parent c71ef5c commit 2561813
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/react/src/components/PageWizard/PageWizard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const PageWizardPropTypes = {
testId: PropTypes.string,
/** Specify whether the progress steps should be split equally in size in the div */
spaceEqually: PropTypes.bool,
stepWidth: PropTypes.number,
};

export const defaultProps = {
Expand All @@ -85,6 +86,7 @@ export const defaultProps = {
isClickable: false,
testId: 'page-wizard',
spaceEqually: false,
stepWidth: null,
};

const PageWizard = ({
Expand All @@ -108,6 +110,7 @@ const PageWizard = ({
isClickable,
testId,
spaceEqually,
stepWidth,
}) => {
const children = ch.length ? ch : [ch];
const steps = React.Children.map(children, (step) => step.props);
Expand Down Expand Up @@ -195,6 +198,7 @@ const PageWizard = ({
isVerticalMode={isProgressIndicatorVertical}
isClickable={isClickable}
spaceEqually={spaceEqually}
stepWidth={stepWidth}
// TODO: pass down the testId in v3 instead of falling back to the
// default.
// testId={`${testId}-progress-indicator`}
Expand Down
5 changes: 3 additions & 2 deletions packages/react/src/components/PageWizard/PageWizard.story.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Used dependencies */
import React, { useState } from 'react';
import { action } from '@storybook/addon-actions';
import { boolean, text } from '@storybook/addon-knobs';
import { boolean, number, text } from '@storybook/addon-knobs';
import { Button, Form, FormGroup, FormItem, Link, TextInput } from 'carbon-components-react';
import { InformationFilled20 } from '@carbon/icons-react';

Expand Down Expand Up @@ -352,7 +352,7 @@ export const StatefulExampleWValidationInPageTitleBar = () => (
<Link to="www.ibm.com">Something</Link>,
<Link to="www.ibm.com">Something Else</Link>,
]}
content={<StepValidationWizard />}
content={<StepValidationWizard stepWidth={number('stepWidth', 6)} />}
/>
</div>
);
Expand Down Expand Up @@ -457,6 +457,7 @@ export const WithStickyFooterStatefulExampleWValidationInPageTitleBar = () => (
isProgressIndicatorVertical={boolean('Toggle Progress Indicator Alignment', false)}
isClickable
spaceEqually={boolean('spaceEqually', false)}
stepWidth={number('stepWidth', 6)}
/>
}
/>
Expand Down

0 comments on commit 2561813

Please sign in to comment.