Skip to content

Commit 9e64a39

Browse files
committed
docs(storybook): add dynamic default slot
1 parent c99429a commit 9e64a39

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

packages/uui-toast-notification/lib/uui-toast-notification.story.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,24 @@ export default {
1111
open: true,
1212
look: '',
1313
headline: 'Toast notification layout headline',
14-
message: 'Message to be displayed, shown by toast notification layout.',
14+
slot: 'Message to be displayed, shown by toast notification layout.',
1515
},
1616
argTypes: {
1717
look: {
1818
options: ['', 'primary', 'positive', 'warning', 'danger'],
1919
control: { type: 'select' },
2020
},
21+
slot: {
22+
control: { type: 'text' },
23+
},
2124
},
2225
};
2326

2427
const Template: Story = props => html`<uui-toast-notification
2528
.open=${props.open}
2629
.look=${props.look}>
2730
<uui-toast-notification-layout .headline=${props.headline}>
28-
${props.message}
31+
${props.slot}
2932
</uui-toast-notification-layout>
3033
</uui-toast-notification>`;
3134

@@ -43,14 +46,13 @@ export const ErrorStyle: Story = props => html`<uui-toast-notification
4346
.open=${props.open}
4447
.look=${props.look}>
4548
<uui-toast-notification-layout .headline=${props.headline}>
46-
${props.message}
49+
${props.slot}
4750
<uui-button slot="actions" look="danger">Retry</uui-button>
4851
</uui-toast-notification-layout>
4952
</uui-toast-notification>`;
5053
ErrorStyle.args = {
5154
headline: 'Document could not be published!',
52-
message:
53-
'An error occurred while attempting to contact the server. Please check your internet connection.',
55+
slot: 'An error occurred while attempting to contact the server. Please check your internet connection.',
5456
look: 'danger',
5557
};
5658
ErrorStyle.parameters = {
@@ -71,13 +73,13 @@ export const PositiveStyle: Story = props => html`<uui-toast-notification
7173
.open=${props.open}
7274
.look=${props.look}>
7375
<uui-toast-notification-layout .headline=${props.headline}>
74-
${props.message}
76+
${props.slot}
7577
<uui-button slot="actions" .look=${props.look}>View in browser</uui-button>
7678
</uui-toast-notification-layout>
7779
</uui-toast-notification>`;
7880
PositiveStyle.args = {
7981
headline: 'Document was published',
80-
message: 'This document is now saved and published.',
82+
slot: 'This document is now saved and published.',
8183
look: 'positive',
8284
};
8385
PositiveStyle.parameters = {
@@ -96,16 +98,19 @@ PositiveStyle.parameters = {
9698
export const CustomLayout: Story = props => html`<uui-toast-notification
9799
.open=${props.open}
98100
look="danger">
99-
Its recommended to use the 'uui-toast-notification-layout' component as the
100-
layout for your toasts. This will ensure consistency in toast appearances,
101-
help achieving the best user experience. If 'uui-toast-notification-layout'
102-
does not provide the options to solve your needs, it is possible append
103-
anything within the toast-notification component. But please consider this
104-
very carefully.
101+
${props.slot
102+
? props.slot
103+
: html` Its recommended to use the 'uui-toast-notification-layout' component
104+
as the layout for your toasts. This will ensure consistency in toast
105+
appearances, help achieving the best user experience. If
106+
'uui-toast-notification-layout' does not provide the options to solve your
107+
needs, it is possible append anything within the toast-notification
108+
component. But please consider this very carefully.`}
105109
</uui-toast-notification>`;
106110
CustomLayout.args = {
107111
headline: '',
108112
look: 'danger',
113+
slot: undefined,
109114
};
110115
CustomLayout.parameters = {
111116
docs: {

0 commit comments

Comments
 (0)