Skip to content

Commit d1721cb

Browse files
committed
EOA-4108: update stories naming and dynamic permalink title
1 parent 6331a88 commit d1721cb

2 files changed

Lines changed: 43 additions & 53 deletions

File tree

src/components/col-toast/col-toast.mdx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Meta, Title, Subtitle, Canvas, Story, ArgTypes } from '@storybook/blocks';
2-
import * as stories from './col-toast.stories';
2+
import * as ColToastStories from './col-toast.stories';
33
import LinkTo from '@storybook/addon-links/react';
44

5-
<Meta of={stories} />
5+
<Meta of={ColToastStories} />
66

77
<div className="col-doc__wrapper">
88
<div className="col-doc__container">
@@ -67,7 +67,7 @@ import LinkTo from '@storybook/addon-links/react';
6767

6868
## Component preview
6969

70-
<Canvas of={stories.InformationDefaultDuration} />
70+
<Canvas of={ColToastStories.Default} />
7171

7272
## Variants
7373

@@ -78,10 +78,10 @@ import LinkTo from '@storybook/addon-links/react';
7878
- **Warning**: Alerts that require attention.
7979
- **Danger**: Errors or critical alerts.
8080

81-
<Canvas of={stories.InformationDefaultDuration} />
82-
<Canvas of={stories.Success} />
83-
<Canvas of={stories.Warning}/>
84-
<Canvas of={stories.Danger} />
81+
<Canvas of={ColToastStories.Default} />
82+
<Canvas of={ColToastStories.Success} />
83+
<Canvas of={ColToastStories.Warning}/>
84+
<Canvas of={ColToastStories.Danger} />
8585

8686
## Types
8787

@@ -90,8 +90,8 @@ import LinkTo from '@storybook/addon-links/react';
9090
- **Informative**: Automatically closes after the specified `duration` in seconds (clamped between 3 and 6 seconds).
9191
- **Action-close**: Requires manual closing by the user via a close button.
9292

93-
<Canvas of={stories.Autoclose} />
94-
<Canvas of={stories.ActionClose} />
93+
<Canvas of={ColToastStories.Autoclose} />
94+
<Canvas of={ColToastStories.ActionClose} />
9595

9696
## Using slots
9797

@@ -103,14 +103,14 @@ import LinkTo from '@storybook/addon-links/react';
103103

104104
Example with all slots used:
105105

106-
<Canvas of={stories.SlotsExample} />
106+
<Canvas of={ColToastStories.SlotsExample} />
107107

108-
## Custom duration
108+
## Custom duration
109109

110110
The `duration` property controls how long the toast stays visible (in seconds). It applies mainly to the `informative` type.
111111

112112
Example custom duration of 10 seconds:
113-
<Canvas of={stories.InformationCustomDuration} />
113+
<Canvas of={ColToastStories.InformationCustomDuration} />
114114

115115
## Accessibility
116116

@@ -124,10 +124,10 @@ import LinkTo from '@storybook/addon-links/react';
124124

125125
## Properties
126126

127-
<ArgTypes of={stories} />
127+
<ArgTypes of={ColToastStories} />
128128

129129
## Interact with the component
130130

131-
You can test the toast's behavior, variants, types, and slots interactively in the <LinkTo title="feedback-toast" story="interactive-toast-example">Canvas tab</LinkTo> section below.
131+
You can test the toast's behavior, variants, types, and slots interactively in the <LinkTo title={ColToastStories.default.title} story="default">Default</LinkTo> section below.
132132
</div>
133133
</div>

src/components/col-toast/col-toast.stories.tsx

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,15 @@ const renderToast: Story['render'] = args => html`
122122
position=${ifDefined(args.position)}
123123
?open=${args.open}
124124
>
125-
${args.icon
126-
? html`<col-icon slot="icon" name=${args.icon}></col-icon>`
127-
: nothing}
125+
${args.icon ? html`<col-icon slot="icon" name=${args.icon}></col-icon>` : nothing}
128126
${args.title
129-
? html`<col-typography variant="subheading" slot="title">${args.title}</col-typography>`
130-
: nothing}
127+
? html`<col-typography variant="subheading" slot="title">${args.title}</col-typography>`
128+
: nothing}
131129
${args.default ?? nothing}
132130
</col-toast>
133131
`;
134132

135-
export const InformationDefaultDuration: Story = {
133+
export const Default: Story = {
136134
render: renderToast,
137135
args: {
138136
variant: 'information',
@@ -149,19 +147,15 @@ export const ActionClose: Story = {
149147
color="primary"
150148
style="padding-bottom:10px;"
151149
@click=${() => {
152-
const toast = document.getElementById('action-close') as ColToast;
153-
if (toast) {
154-
toast.open = true;
155-
}
156-
}}
150+
const toast = document.getElementById('action-close') as ColToast;
151+
if (toast) {
152+
toast.open = true;
153+
}
154+
}}
157155
>
158156
Show Toast
159157
</col-button>
160-
<col-toast
161-
id="action-close"
162-
variant=${args.variant}
163-
type=${args.type}
164-
>
158+
<col-toast id="action-close" variant=${args.variant} type=${args.type}>
165159
<col-typography variant="subheading" slot="title">${args.title}</col-typography>
166160
${args.default}
167161
</col-toast>
@@ -174,18 +168,17 @@ export const ActionClose: Story = {
174168
},
175169
};
176170

177-
178171
export const Autoclose: Story = {
179172
render: args => html`
180173
<col-button
181174
color="primary"
182175
style="padding-bottom:10px;"
183176
@click=${() => {
184-
const toast = document.getElementById('autoclose') as ColToast;
185-
if (toast) {
186-
toast.open = true;
187-
}
188-
}}
177+
const toast = document.getElementById('autoclose') as ColToast;
178+
if (toast) {
179+
toast.open = true;
180+
}
181+
}}
189182
>
190183
Show Toast
191184
</col-button>
@@ -232,8 +225,7 @@ export const Autoclose: Story = {
232225
language: 'html',
233226
},
234227
},
235-
}
236-
228+
},
237229
};
238230

239231
export const InformationCustomDuration: Story = {
@@ -242,11 +234,11 @@ export const InformationCustomDuration: Story = {
242234
color="primary"
243235
style="padding-bottom:10px;"
244236
@click=${() => {
245-
const toast = document.getElementById('customDuration') as ColToast;
246-
if (toast) {
247-
toast.open = true;
248-
}
249-
}}
237+
const toast = document.getElementById('customDuration') as ColToast;
238+
if (toast) {
239+
toast.open = true;
240+
}
241+
}}
250242
>
251243
Show Toast
252244
</col-button>
@@ -295,11 +287,9 @@ export const InformationCustomDuration: Story = {
295287
language: 'html',
296288
},
297289
},
298-
}
299-
290+
},
300291
};
301292

302-
303293
export const Success: Story = {
304294
render: renderToast,
305295
args: {
@@ -361,19 +351,19 @@ export const InteractiveToastExample: Story = {
361351
title: 'Interactive Toast',
362352
default: 'You can control this toast using the controls and open it manually.',
363353
},
364-
render: (args) => {
354+
render: args => {
365355
const toastId = 'interactive-toast-example';
366356

367357
return html`
368358
<col-button
369359
color="primary"
370360
style="padding-bottom:10px;"
371361
@click=${() => {
372-
const toast = document.getElementById(toastId) as ColToast;
373-
if (toast) {
374-
toast.open = true;
375-
}
376-
}}
362+
const toast = document.getElementById(toastId) as ColToast;
363+
if (toast) {
364+
toast.open = true;
365+
}
366+
}}
377367
>
378368
Show Toast
379369
</col-button>
@@ -419,4 +409,4 @@ export const InteractiveToastExample: Story = {
419409
name: 'Content',
420410
},
421411
},
422-
};
412+
};

0 commit comments

Comments
 (0)