diff --git a/packages/components/form-step/index.tsx b/packages/components/form-step/index.tsx index 83c2050680c..18754218c1b 100644 --- a/packages/components/form-step/index.tsx +++ b/packages/components/form-step/index.tsx @@ -31,7 +31,7 @@ const StepHeading = ( { title, stepHeadingContent }: StepHeadingProps ) => ( ); -interface FormStepProps { +export interface FormStepProps { id?: string; className?: string; title?: string; diff --git a/packages/components/form-step/stories/index.stories.tsx b/packages/components/form-step/stories/index.stories.tsx new file mode 100644 index 00000000000..895e6af8bda --- /dev/null +++ b/packages/components/form-step/stories/index.stories.tsx @@ -0,0 +1,126 @@ +/** + * External dependencies + */ +import type { StoryFn, Meta } from '@storybook/react'; +import { ValidatedTextInput } from '@woocommerce/blocks-checkout'; +import { useState } from '@wordpress/element'; + +/** + * Internal dependencies + */ +import FormStep, { type FormStepProps } from '..'; +import '../style.scss'; + +export default { + title: 'Checkout Components/FormStep', + component: FormStep, + argTypes: { + className: { + control: 'text', + table: { + type: { + summary: 'string', + }, + }, + }, + id: { + control: 'text', + table: { + type: { + summary: 'string', + }, + }, + }, + title: { + control: 'text', + table: { + type: { + summary: 'string', + }, + }, + description: 'The title of the form step.', + }, + legend: { + control: 'text', + table: { + type: { + summary: 'string', + }, + }, + description: + 'The legend is hidden but is made available to screen readers.', + }, + description: { + control: 'text', + table: { + type: { + summary: 'string', + }, + }, + description: + 'The description of the form step. Appears under the title.', + }, + children: { + table: { + type: { + summary: 'ReactNode', + }, + }, + control: 'disabled', + description: 'The content of the form step.', + }, + disabled: { + control: 'boolean', + table: { + type: { + summary: 'boolean', + }, + }, + description: 'Is the component and all of its children disabled?', + }, + showStepNumber: { + table: { + type: { + summary: 'boolean', + }, + }, + control: 'boolean', + description: 'Should the step number be shown?', + }, + stepHeadingContent: { + table: { + type: { + summary: '() => JSX.Element | undefined', + }, + }, + description: 'Content to render in the step heading.', + }, + }, +} as Meta< FormStepProps >; + +const InputWithState = () => { + const [ value, setValue ] = useState( 'John Doe' ); + return ( + + ); +}; +const Template: StoryFn< FormStepProps > = ( args ) => ( +
+ + + +
+); + +export const Default = Template.bind( {} ); + +Default.args = { + stepHeadingContent: () => Step heading content, + title: 'Personal information', + description: 'Please enter your personal information.', +}; diff --git a/storybook/preview.js b/storybook/preview.js index c153d6b355b..95cb24a0318 100644 --- a/storybook/preview.js +++ b/storybook/preview.js @@ -12,7 +12,7 @@ export const parameters = { date: /Date$/, }, }, - layout: 'centered', + layout: 'padded', a11y: { element: '#storybook-root', config: {},