Skip to content

Commit 28bef3c

Browse files
Always pass args to storybook examples
1 parent 9da0890 commit 28bef3c

23 files changed

+402
-390
lines changed

stories/Content Presentation/DoAndDontList.stories.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ export default meta;
4545
type Story = StoryObj<typeof DoAndDontList>;
4646

4747
export const Do: Story = {
48+
args: {
49+
listType: 'do',
50+
},
4851
render: (args) => (
49-
<DoAndDontList listType="do">
52+
<DoAndDontList {...args}>
5053
<DoAndDontList.Item>
5154
cover blisters that are likely to burst with a soft plaster or dressing
5255
</DoAndDontList.Item>
@@ -59,8 +62,11 @@ export const Do: Story = {
5962
};
6063

6164
export const Dont: Story = {
65+
args: {
66+
listType: 'dont',
67+
},
6268
render: (args) => (
63-
<DoAndDontList listType="dont">
69+
<DoAndDontList {...args}>
6470
<DoAndDontList.Item>burst a blister yourself</DoAndDontList.Item>
6571
<DoAndDontList.Item>peel the skin off a burst blister</DoAndDontList.Item>
6672
<DoAndDontList.Item>pick at the edges of the remaining skin</DoAndDontList.Item>
@@ -90,8 +96,11 @@ export const Dont: Story = {
9096
* | JSX | The JSX will be rendered, such as `<span>` |
9197
*/
9298
export const CustomPrefixText: Story = {
93-
render: () => (
94-
<DoAndDontList listType="dont">
99+
args: {
100+
listType: 'dont',
101+
},
102+
render: (args) => (
103+
<DoAndDontList {...args}>
95104
<DoAndDontList.Item prefixText="You must not">burst a blister yourself</DoAndDontList.Item>
96105
<DoAndDontList.Item prefixText={undefined}>
97106
peel the skin off a burst blister

stories/Content Presentation/NotificationBanner.stories.tsx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ type Story = StoryObj<typeof NotificationBanner>;
4141

4242
export const StandardPanel: Story = {
4343
args: {},
44-
render: () => (
45-
<NotificationBanner>
44+
render: (args) => (
45+
<NotificationBanner {...args}>
4646
<NotificationBanner.Heading>
4747
The service will be unavailable from 8pm to 9pm on Thursday 1 January 2025.
4848
</NotificationBanner.Heading>
@@ -51,9 +51,11 @@ export const StandardPanel: Story = {
5151
};
5252

5353
export const SuccessPanel: Story = {
54-
args: {},
55-
render: () => (
56-
<NotificationBanner success>
54+
args: {
55+
success: true,
56+
},
57+
render: (args) => (
58+
<NotificationBanner {...args}>
5759
<NotificationBanner.Heading>Patient record updated</NotificationBanner.Heading>
5860
<p>
5961
Contact{' '}
@@ -66,8 +68,8 @@ export const SuccessPanel: Story = {
6668

6769
export const StandardPanelWithLink: Story = {
6870
args: {},
69-
render: () => (
70-
<NotificationBanner>
71+
render: (args) => (
72+
<NotificationBanner {...args}>
7173
<NotificationBanner.Heading>
7274
You have 7 days left to send your application.{' '}
7375
<NotificationBanner.Link href="#">View application</NotificationBanner.Link>.
@@ -80,8 +82,8 @@ export const StandardPanelWithCustomTitle: Story = {
8082
args: {
8183
title: 'Important Message',
8284
},
83-
render: () => (
84-
<NotificationBanner>
85+
render: (args) => (
86+
<NotificationBanner {...args}>
8587
<NotificationBanner.Heading>Upcoming maintenance</NotificationBanner.Heading>
8688
<p>The service will be unavailable from 8pm to 9pm on Thursday 1 January 2025.</p>
8789
</NotificationBanner>
@@ -90,8 +92,8 @@ export const StandardPanelWithCustomTitle: Story = {
9092

9193
export const StandardPanelWithCustomTitleElement: Story = {
9294
args: {},
93-
render: () => (
94-
<NotificationBanner>
95+
render: (args) => (
96+
<NotificationBanner {...args}>
9597
<NotificationBanner.Title>
9698
Maintenance <time dateTime="2025-01-01">January 1</time>
9799
</NotificationBanner.Title>
@@ -103,8 +105,8 @@ export const StandardPanelWithCustomTitleElement: Story = {
103105

104106
export const StandardPanelWithList: Story = {
105107
args: {},
106-
render: () => (
107-
<NotificationBanner>
108+
render: (args) => (
109+
<NotificationBanner {...args}>
108110
<NotificationBanner.Heading>4 files uploaded</NotificationBanner.Heading>
109111
<ul>
110112
<li>
@@ -126,8 +128,8 @@ export const StandardPanelWithList: Story = {
126128

127129
export const StandardPanelWithLotsOfContent: Story = {
128130
args: {},
129-
render: () => (
130-
<NotificationBanner>
131+
render: (args) => (
132+
<NotificationBanner {...args}>
131133
<NotificationBanner.Heading>
132134
Check if you need to apply the reverse charge to this application
133135
</NotificationBanner.Heading>

stories/Content Presentation/Panel.stories.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ export default meta;
99
type Story = StoryObj<typeof Panel>;
1010

1111
export const StandardPanel: Story = {
12-
render: () => (
13-
<Panel>
12+
render: (args) => (
13+
<Panel {...args}>
1414
<Panel.Title>Booking complete</Panel.Title>
1515
We have sent you a confirmation email
1616
</Panel>
1717
),
1818
};
1919

2020
export const PanelWithCustomHeadingLevel: Story = {
21-
render: () => (
22-
<Panel>
21+
render: (args) => (
22+
<Panel {...args}>
2323
<Panel.Title headingLevel="h2">Booking complete</Panel.Title>
2424
We have sent you a confirmation email
2525
</Panel>

stories/Content Presentation/Tabs.stories.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export default meta;
1818
type Story = StoryObj<typeof Tabs>;
1919

2020
export const Standard: Story = {
21-
render: () => (
22-
<Tabs>
21+
render: (args) => (
22+
<Tabs {...args}>
2323
<Tabs.Title>Contents</Tabs.Title>
2424
<Tabs.List>
2525
<Tabs.ListItem id="past-day">Past day</Tabs.ListItem>
@@ -48,8 +48,8 @@ export const Standard: Story = {
4848
* It also displays if the user has JavaScript disabled.
4949
*/
5050
export const DifferentAccessibleHeading: Story = {
51-
render: () => (
52-
<Tabs>
51+
render: (args) => (
52+
<Tabs {...args}>
5353
<Tabs.Title headingLevel="h1">Tabs title</Tabs.Title>
5454
<Tabs.List>
5555
<Tabs.ListItem id="past-day-2">Past day</Tabs.ListItem>

stories/Content Presentation/Tag.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type Story = StoryObj<typeof Tag>;
1111
export const StandardTag: Story = { args: { children: 'Standard' } };
1212

1313
export const AllColours: Story = {
14-
render: (args) => (
14+
render: () => (
1515
<div className="tag-wrapper">
1616
<Tag modifier="white">Started</Tag>
1717
<Tag modifier="grey">Not started</Tag>

stories/Content Presentation/WarningCallout.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type Story = StoryObj<typeof WarningCallout>;
1010

1111
export const StandardWarningCallout: Story = {
1212
render: (args) => (
13-
<WarningCallout>
13+
<WarningCallout {...args}>
1414
<WarningCallout.Heading>Important</WarningCallout.Heading>
1515
<p>
1616
For safety, tell your doctor or pharmacist if you&apos;re taking any other medicines,
@@ -24,7 +24,7 @@ export const StandardWarningCallout: Story = {
2424

2525
export const WarningCalloutWithCustomHeading: Story = {
2626
render: (args) => (
27-
<WarningCallout>
27+
<WarningCallout {...args}>
2828
<WarningCallout.Heading>School, nursery or work</WarningCallout.Heading>
2929
<p>
3030
Stay away from school, nursery or work until all the spots have crusted over. This is
@@ -36,7 +36,7 @@ export const WarningCalloutWithCustomHeading: Story = {
3636

3737
export const WarningCalloutWithCustomHeadingLevel: Story = {
3838
render: (args) => (
39-
<WarningCallout>
39+
<WarningCallout {...args}>
4040
<WarningCallout.Heading headingLevel="h4">School, nursery or work</WarningCallout.Heading>
4141
<p>
4242
Stay away from school, nursery or work until all the spots have crusted over. This is

stories/Form Elements/CharacterCount.stories.tsx

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ import { CharacterCount } from '#components';
1212
const meta: Meta<typeof CharacterCount> = {
1313
title: 'Form Elements/CharacterCount',
1414
component: CharacterCount,
15+
args: {
16+
label: 'Can you provide more detail?',
17+
labelProps: { isPageHeading: true, size: 'l' },
18+
hint: 'Do not include personal information like your name, date of birth or NHS number',
19+
name: 'example',
20+
rows: 5,
21+
},
1522
};
1623

1724
export default meta;
1825
type Story = StoryObj<typeof CharacterCount>;
1926

2027
export const Standard: Story = {
21-
render: () => (
22-
<CharacterCount
23-
label="Can you provide more detail?"
24-
labelProps={{ isPageHeading: true, size: 'l' }}
25-
hint="Do not include personal information like your name, date of birth or NHS number"
26-
name="example"
27-
maxLength={200}
28-
rows={5}
29-
/>
30-
),
28+
args: {
29+
maxLength: 200,
30+
},
3131
};
3232

3333
/**
@@ -36,16 +36,9 @@ export const Standard: Story = {
3636
* Use the `countType` prop to vary this behaviour.
3737
*/
3838
export const WordCountLimit: Story = {
39-
render: () => (
40-
<CharacterCount
41-
label="Can you provide more detail?"
42-
labelProps={{ isPageHeading: true, size: 'l' }}
43-
hint="Do not include personal information like your name, date of birth or NHS number"
44-
name="example"
45-
maxWords={150}
46-
rows={5}
47-
/>
48-
),
39+
args: {
40+
maxWords: 150,
41+
},
4942
};
5043

5144
/**
@@ -54,15 +47,8 @@ export const WordCountLimit: Story = {
5447
* Use the `threshold` prop to only show the count message when users have reached that percentage of the limit.
5548
*/
5649
export const MessageThreshold: Story = {
57-
render: () => (
58-
<CharacterCount
59-
label="Can you provide more detail?"
60-
labelProps={{ isPageHeading: true, size: 'l' }}
61-
hint="Do not include personal information like your name, date of birth or NHS number"
62-
name="example"
63-
maxLength={112}
64-
threshold={75}
65-
rows={5}
66-
/>
67-
),
50+
args: {
51+
maxLength: 112,
52+
threshold: 75,
53+
},
6854
};

0 commit comments

Comments
 (0)