Skip to content

Commit 88e8b9b

Browse files
committed
footer& step stories
1 parent e33f53f commit 88e8b9b

File tree

2 files changed

+211
-0
lines changed

2 files changed

+211
-0
lines changed
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
import React, { useState } from 'react';
2+
import {
3+
storybookArgTypes,
4+
StoryMetaType,
5+
StoryType,
6+
} from '@lg-tools/storybook-utils';
7+
8+
import { WizardFooter } from '.';
9+
10+
const meta: StoryMetaType<typeof WizardFooter> = {
11+
title: 'Components/Wizard/WizardFooter',
12+
component: WizardFooter,
13+
parameters: {
14+
default: 'LiveExample',
15+
},
16+
argTypes: {
17+
backButtonProps: { control: 'object' },
18+
cancelButtonProps: { control: 'object' },
19+
primaryButtonProps: { control: 'object' },
20+
activeStep: { control: 'number' },
21+
totalSteps: { control: 'number' },
22+
onStepChange: storybookArgTypes.func,
23+
isControlled: { control: 'boolean' },
24+
},
25+
};
26+
27+
export default meta;
28+
29+
const Template: StoryType<typeof WizardFooter> = args => {
30+
const [step, setStep] = useState(args.activeStep || 0);
31+
32+
return (
33+
<WizardFooter
34+
{...args}
35+
activeStep={step}
36+
onStepChange={newStep => {
37+
setStep(newStep);
38+
args.onStepChange?.(newStep);
39+
}}
40+
/>
41+
);
42+
};
43+
44+
export const LiveExample = Template.bind({});
45+
LiveExample.args = {
46+
activeStep: 1,
47+
totalSteps: 3,
48+
backButtonProps: {
49+
children: 'Back',
50+
},
51+
cancelButtonProps: {
52+
children: 'Cancel',
53+
},
54+
primaryButtonProps: {
55+
children: 'Next',
56+
variant: 'primary',
57+
},
58+
};
59+
60+
export const FirstStep = Template.bind({});
61+
FirstStep.args = {
62+
activeStep: 0,
63+
totalSteps: 3,
64+
cancelButtonProps: {
65+
children: 'Cancel',
66+
},
67+
primaryButtonProps: {
68+
children: 'Get Started',
69+
variant: 'primary',
70+
},
71+
};
72+
73+
export const LastStep = Template.bind({});
74+
LastStep.args = {
75+
activeStep: 2,
76+
totalSteps: 3,
77+
backButtonProps: {
78+
children: 'Back',
79+
},
80+
cancelButtonProps: {
81+
children: 'Cancel',
82+
},
83+
primaryButtonProps: {
84+
children: 'Finish',
85+
variant: 'primary',
86+
},
87+
};
88+
89+
export const DangerousAction = Template.bind({});
90+
DangerousAction.args = {
91+
activeStep: 1,
92+
totalSteps: 2,
93+
backButtonProps: {
94+
children: 'Back',
95+
},
96+
cancelButtonProps: {
97+
children: 'Cancel',
98+
},
99+
primaryButtonProps: {
100+
children: 'Delete Resource',
101+
variant: 'danger',
102+
},
103+
};
104+
105+
export const WithCustomHandlers = Template.bind({});
106+
WithCustomHandlers.args = {
107+
activeStep: 1,
108+
totalSteps: 3,
109+
backButtonProps: {
110+
children: 'Go Back',
111+
onClick: () => alert('Custom back handler'),
112+
},
113+
cancelButtonProps: {
114+
children: 'Exit',
115+
onClick: () => alert('Custom cancel handler'),
116+
},
117+
primaryButtonProps: {
118+
children: 'Continue',
119+
variant: 'primary',
120+
onClick: () => alert('Custom primary handler'),
121+
},
122+
};
123+
124+
export const MinimalFooter = Template.bind({});
125+
MinimalFooter.args = {
126+
activeStep: 0,
127+
totalSteps: 1,
128+
primaryButtonProps: {
129+
children: 'Done',
130+
variant: 'primary',
131+
},
132+
};
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import React from 'react';
2+
import {
3+
storybookArgTypes,
4+
StoryMetaType,
5+
StoryType,
6+
} from '@lg-tools/storybook-utils';
7+
8+
import { WizardStep } from '.';
9+
10+
const meta: StoryMetaType<typeof WizardStep> = {
11+
title: 'Components/Wizard/WizardStep',
12+
component: WizardStep,
13+
parameters: {
14+
default: 'LiveExample',
15+
},
16+
argTypes: {
17+
title: storybookArgTypes.children,
18+
description: storybookArgTypes.children,
19+
children: storybookArgTypes.children,
20+
},
21+
};
22+
23+
export default meta;
24+
25+
const Template: StoryType<typeof WizardStep> = args => <WizardStep {...args} />;
26+
27+
export const LiveExample = Template.bind({});
28+
LiveExample.args = {
29+
title: 'Step 1: Basic Information',
30+
description: 'Please provide your basic information to get started.',
31+
children: (
32+
<div>
33+
<p>This is the content of the step.</p>
34+
<p>You can include forms, instructions, or any other content here.</p>
35+
</div>
36+
),
37+
};
38+
39+
export const WithLongDescription = Template.bind({});
40+
WithLongDescription.args = {
41+
title: 'Step 2: Detailed Configuration',
42+
description: (
43+
<div>
44+
<p>
45+
This step involves more complex configuration options. Please read
46+
carefully before proceeding.
47+
</p>
48+
<ul>
49+
<li>Configure your primary settings</li>
50+
<li>Set up your preferences</li>
51+
<li>Review the terms and conditions</li>
52+
</ul>
53+
</div>
54+
),
55+
children: (
56+
<div>
57+
<p>Complex form content would go here...</p>
58+
<button type="button">Sample Button</button>
59+
</div>
60+
),
61+
};
62+
63+
export const MinimalStep = Template.bind({});
64+
MinimalStep.args = {
65+
title: 'Final Step',
66+
description: 'Review and submit.',
67+
children: <p>Simple content for the final step.</p>,
68+
};
69+
70+
export const WithoutDescription = Template.bind({});
71+
WithoutDescription.args = {
72+
title: 'Step Without Description',
73+
children: (
74+
<div>
75+
<p>This step doesn&apos;t have a description.</p>
76+
<p>Sometimes you may want to omit the description for simpler steps.</p>
77+
</div>
78+
),
79+
};

0 commit comments

Comments
 (0)