Skip to content

Commit 5c3c954

Browse files
docs(dialog): updates to dialog to better reflect structure
1 parent 75d069a commit 5c3c954

File tree

2 files changed

+130
-105
lines changed

2 files changed

+130
-105
lines changed

components/dialog/stories/dialog.stories.js

+51-38
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
import { Template as Typography } from "@spectrum-css/typography/stories/template.js";
22
import { version } from "../package.json";
3-
import { Template } from "./template";
3+
// import { DialogFullscreen, DialogFullscreenTakeover, DialogGroup } from "./dialog.test.js";
4+
import { Template } from "./template.js";
45

56
/**
6-
* A dialog displays important information that users need to acknowledge. They appear over the interface and block further interactions.
7+
* A dialog displays important information that users need to acknowledge. They appear over the interface and block further interactions. Standard dialogs are the most frequent type of dialogs. They appear in the center of the screen over the interface and should be used for moderately complex tasks. Takeover dialogs are large types of dialogs. They use the totality of the screen and should be used for modal experiences with complex workflows.
78
*
8-
* The alert variants that were previously a part of Dialog were moved to their own component, [Alert Dialog](/docs/components-alert-dialog--docs).
9+
* The alert variants that were previously a part of Dialog were moved to their own component, [alert dialog](/docs/components-alert-dialog--docs).
910
*/
1011
export default {
1112
title: "Components/Dialog",
1213
component: "Dialog",
1314
argTypes: {
1415
heading: {
1516
name: "Heading",
17+
description: "Title for the dialog.",
1618
type: { name: "string" },
1719
table: {
1820
type: { summary: "string" },
@@ -22,7 +24,7 @@ export default {
2224
},
2325
header: {
2426
name: "Additional header content",
25-
description: "Controls header content",
27+
description: "Controls header content.",
2628
type: { name: "string" },
2729
table: {
2830
type: { summary: "string" },
@@ -33,23 +35,13 @@ export default {
3335
content: { table: { disable: true } },
3436
hasFooter: {
3537
name: "Has footer",
36-
description: "Adds a footer to the dialog for additional context",
38+
description: "Adds a footer to the dialog for additional context.",
3739
type: { name: "boolean" },
3840
table: {
3941
type: { summary: "boolean" },
4042
category: "Content",
4143
},
4244
control: "boolean",
43-
},
44-
hasCheckbox: {
45-
name: "Has checkbox",
46-
description: "Adds a checkbox to the footer content.",
47-
type: { name: "boolean" },
48-
table: {
49-
type: { summary: "boolean" },
50-
category: "Content",
51-
},
52-
control: { type: "boolean" },
5345
if: { arg: "layout", eq: "default" },
5446
},
5547
footer: {
@@ -61,7 +53,18 @@ export default {
6153
category: "Content",
6254
},
6355
control: { type: "text" },
64-
if: { arg: "layout", eq: "default" },
56+
if: { arg: "hasFooter", truthy: true },
57+
},
58+
hasCheckbox: {
59+
name: "Has checkbox",
60+
description: "Adds a checkbox to the footer content.",
61+
type: { name: "boolean" },
62+
table: {
63+
type: { summary: "boolean" },
64+
category: "Content",
65+
},
66+
control: { type: "boolean" },
67+
if: { arg: "hasFooter", truthy: true },
6568
},
6669
size: {
6770
name: "Size",
@@ -70,7 +73,7 @@ export default {
7073
type: { summary: "string" },
7174
category: "Component",
7275
},
73-
options: ["small", "medium", "large"],
76+
options: ["s", "m", "l"],
7477
control: "select",
7578
},
7679
layout: {
@@ -82,8 +85,7 @@ export default {
8285
category: "Component",
8386
defaultValue: { summary: "Default" },
8487
},
85-
// TODO: add the fullscreen and fullscreenTakeover layouts back to options[] once guidance on fullscreen dialogs is determined
86-
options: ["default"],
88+
options: ["default", "fullscreen", "fullscreenTakeover"],
8789
control: "select",
8890
},
8991
isDismissible: {
@@ -133,7 +135,7 @@ export default {
133135
isDismissible: false,
134136
isOpen: true,
135137
showModal: false,
136-
size: "medium",
138+
size: "m",
137139
layout: "default",
138140
hasCheckbox: true,
139141
},
@@ -143,7 +145,7 @@ export default {
143145
},
144146
docs: {
145147
story: {
146-
inline: false,
148+
// inline: false,
147149
height: "500px",
148150
},
149151
},
@@ -157,25 +159,26 @@ export default {
157159
const ExampleContent = "Standard dialog description. This should briefly communicate any additional information or context about the standard dialog title, to help users make one of the decisions offered by the buttons. Make it no more than a few short sentences.";
158160

159161
/**
160-
* The default size for dialog is medium.
162+
* The default size for dialog is medium. The default dialog also has a checkbox in the footer.
161163
*/
162164
export const Default = Template.bind({});
163165
Default.args = {
164166
heading: "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
165-
header: "*Required",
167+
header: "* Required",
166168
showModal: true,
167169
content: [
168-
() => Typography({
170+
(passthroughs, context) => Typography({
169171
semantics: "body",
170172
size: "m",
171-
content: ExampleContent,
172-
}),
173+
content: [ ExampleContent ],
174+
...passthroughs,
175+
}, context),
173176
],
174177
};
175178

176-
/* TODO: For all dialog stories: the "is-hidden-story" tags replicates "!dev" in older versions
177-
of Storybook, to remove the stories from the side navigation, reflecting the intended behavior.
178-
Remove "is-hidden-story" in favor of only "!dev" tags when possible.
179+
/* TODO: For all dialog stories: the "is-hidden-story" tags in older versions of Storybook. In newer versions,
180+
use "!dev" to remove the stories from the side navigation, reflecting the intended behavior.
181+
Remove "is-hidden-story" in favor of "!dev" tags when possible.
179182
*/
180183
// ********* DOCS ONLY ********* //
181184
export const DefaultSmall = Template.bind({});
@@ -218,6 +221,7 @@ Dismissible.args = {
218221
*/
219222
export const WithHero = Template.bind({});
220223
WithHero.tags = ["is-hidden-story", "!dev"];
224+
WithHero.storyName = "With hero image";
221225
WithHero.parameters = {
222226
docs: {
223227
story: {
@@ -238,47 +242,56 @@ WithHero.args = {
238242
export const WithScroll = Template.bind({});
239243
WithScroll.args = {
240244
...Default.args,
241-
content: [ExampleContent, ExampleContent, ExampleContent, ExampleContent],
245+
content: [ ExampleContent, ExampleContent, ExampleContent, ExampleContent ],
242246
customStyles: {
243247
"max-block-size": "400px",
244248
}
245249
};
250+
WithScroll.storyName = "Scrollable";
246251
WithScroll.tags = ["is-hidden-story", "!dev"];
247252
WithScroll.parameters = {
248253
chromatic: { disableSnapshot: true },
249254
};
250255

256+
/* TODO: once this gets rebased with `main`, make sure to use the fullscreen and fullscreenTakeover test templates
257+
that are imported above, but commented out.
258+
*/
251259
/**
252-
* A fullscreen dialog will automatically fill almost all of the available screen space. A margin is included around the outside of the dialog.
260+
* The full screen variant shows a large dialog background, only revealing a small portion of the page around the outside of the dialog, behind an overlay. The size of the dialog varies with the size of the screen, in both width and height.
253261
*/
254262
export const Fullscreen = Template.bind({});
263+
Fullscreen.argTypes = {
264+
hasCheckbox: { table: { disable: true } },
265+
footer: { table: { disable: true } },
266+
};
255267
Fullscreen.args = {
256268
...Default.args,
257269
layout: "fullscreen",
258270
};
259271
Fullscreen.parameters = {
260272
chromatic: { disableSnapshot: true },
261273
};
262-
/* TODO: Remove "is-hidden-story" tag once guidance for S2 fullscreen dialogs has been determined. */
263-
Fullscreen.tags = ["is-hidden-story"];
264274

265275
/**
266-
* A fullscreen takeover dialog will fill all of the available screen space.
276+
* The full screen takeover variant is similar to the full screen variant except that the background covers the entire screen. The page behind the dialog is not visible. This variant should be reserved for workflows where displaying a second dialog on top of the first one is to be expected.
267277
*/
268278
export const FullscreenTakeover = Template.bind({});
279+
FullscreenTakeover.storyName = "Fullscreen takeover";
280+
FullscreenTakeover.argTypes = {
281+
hasCheckbox: { table: { disable: true } },
282+
footer: { table: { disable: true } },
283+
};
269284
FullscreenTakeover.parameters = {
270285
chromatic: { disableSnapshot: true },
271286
};
272287
FullscreenTakeover.args = {
273288
...Default.args,
274289
layout: "fullscreenTakeover",
275-
content: [ExampleContent, ExampleContent, ExampleContent, ExampleContent, ExampleContent, ExampleContent, ExampleContent, ExampleContent],
290+
content: [ ExampleContent, ExampleContent, ExampleContent, ExampleContent, ExampleContent, ExampleContent, ExampleContent, ExampleContent ],
276291
};
277-
/* TODO: Remove "is-hidden-story" tag once guidance for S2 fullscreen dialogs has been determined. */
278-
FullscreenTakeover.tags = ["is-hidden-story"];
279292

280293
// ********* VRT ONLY ********* //
281-
export const WithForcedColors = Template.bind({});
294+
export const WithForcedColors = Default.bind({});
282295
WithForcedColors.args = Default.args;
283296
WithForcedColors.tags = ["!autodocs", "!dev"];
284297
WithForcedColors.parameters = {

0 commit comments

Comments
 (0)