Skip to content

Commit 59e1fb5

Browse files
docs: storybook cleanup
- clarify language around density options - other minor documentation edits for clarity, grammar, format, and consistent class notation (`.class-name`) - use sentence case where it wasn't used - add description to hasNoInlinePadding - add migrated tags/status - move custom width story to hang out with the other docs only stories - centers accordion - because default width tokens are applied, the padded layout no longer seems necessary and looks awkward left-aligned, but we can bring this back if there are unintended side effects
1 parent 44d54e4 commit 59e1fb5

File tree

1 file changed

+44
-34
lines changed

1 file changed

+44
-34
lines changed

components/accordion/stories/accordion.stories.js

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ import { AccordionGroup, testsContent as accordionContent } from "./accordion.te
77
import { Template } from "./template.js";
88

99
/**
10-
* The accordion element contains a list of items that can be expanded or collapsed to reveal additional content or information associated with each item. There can be zero expanded items, exactly one expanded item, or more than one item expanded at a time, depending on the configuration. This list of items is defined by child accordion item elements.
10+
* The accordion element contains a list of items that can be expanded or collapsed to reveal
11+
* additional content or information associated with each item. There can be zero expanded items,
12+
* exactly one expanded item, or more than one item expanded at a time, depending on the
13+
* configuration. This list of items is defined by child accordion item elements.
1114
*
12-
* Accordion has three density options: regular (default), compact, or spacious. Each of the different densities have the same font size, but have tighter or looser vertical spacing between the rows.
15+
* Accordion has three density options: regular (default), compact, or spacious. While all the
16+
* densities maintain the same font size, compact density reduces vertical spacing between rows,
17+
* while spacious density increases it.
1318
*/
1419
export default {
1520
title: "Accordion",
@@ -46,7 +51,8 @@ export default {
4651
control: "select",
4752
},
4853
hasNoInlinePadding: {
49-
name: "No Inline Padding Styling",
54+
name: "No inline padding styling",
55+
description: "Displays accordion item headers without default inline padding.",
5056
type: { name: "boolean" },
5157
table: {
5258
type: { summary: "boolean" },
@@ -66,8 +72,6 @@ export default {
6672
hasNoInlinePadding: false,
6773
},
6874
parameters: {
69-
// Prevent an inacurate depiction of width due to "centered" layout's use of flex on the body.
70-
layout: "padded",
7175
actions: {
7276
handles: ["click .spectrum-Accordion-item"],
7377
},
@@ -78,11 +82,13 @@ export default {
7882
},
7983
packageJson,
8084
metadata,
85+
status: {
86+
type: "migrated",
87+
},
88+
tags: ["migrated"],
8189
},
8290
};
8391

84-
/* Content sourced from: https://www.adobe.com/products/catalog.html#:~:text=Frequently%20asked%20questions. */
85-
8692
/**
8793
* The default accordion displays at medium size with a regular density.
8894
*/
@@ -94,9 +100,22 @@ Default.parameters = {
94100
chromatic: { disableSnapshot: false },
95101
};
96102

103+
// ********* VRT ONLY ********* //
104+
export const WithForcedColors = AccordionGroup.bind({});
105+
WithForcedColors.args = Default.args;
106+
WithForcedColors.tags = ["!autodocs", "!dev"];
107+
WithForcedColors.parameters = {
108+
chromatic: {
109+
forcedColors: "active",
110+
modes: disableDefaultModes
111+
},
112+
};
113+
114+
// ********* DOCS ONLY ********* //
115+
97116
/**
98-
* Accordion items have a default width, but a custom width can also be set, as long as it is not
99-
* smaller than the minimum width.
117+
* Accordion items have a default width for each size, but a custom width can also be set to any
118+
* width that meets or exceeds the minimum width.
100119
*/
101120
export const CustomWidth = AccordionGroup.bind({});
102121
CustomWidth.tags = ["!dev"];
@@ -111,21 +130,8 @@ CustomWidth.parameters = {
111130
chromatic: { disableSnapshot: false },
112131
};
113132

114-
// ********* VRT ONLY ********* //
115-
export const WithForcedColors = AccordionGroup.bind({});
116-
WithForcedColors.args = Default.args;
117-
WithForcedColors.tags = ["!autodocs", "!dev"];
118-
WithForcedColors.parameters = {
119-
chromatic: {
120-
forcedColors: "active",
121-
modes: disableDefaultModes
122-
},
123-
};
124-
125-
// ********* DOCS ONLY ********* //
126-
127133
/**
128-
* The compact density has less spacing between rows.
134+
* The compact density has less vertical spacing between rows.
129135
*/
130136
export const Compact = Template.bind({});
131137
Compact.tags = ["!dev"];
@@ -139,7 +145,7 @@ Compact.parameters = {
139145
Compact.storyName = "Density: Compact";
140146

141147
/**
142-
* The spacious density has more spacing between rows.
148+
* The spacious density has more vertical spacing between rows.
143149
*/
144150
export const Spacious = Template.bind({});
145151
Spacious.tags = ["!dev"];
@@ -153,8 +159,9 @@ Spacious.parameters = {
153159
Spacious.storyName = "Density: Spacious";
154160

155161
/**
156-
* Individual accordion items (of class `.spectrum-Accordion-item`) can be styled as disabled by applying the `is-disabled` class.
157-
* This example markup also applies the `disabled` attribute on the heading button.
162+
* Individual accordion items can be disabled by applying the `.is-disabled` class to the
163+
* `.spectrum-Accordion-item` element. This example also demonstrates the use of the disabled
164+
* attribute on the heading button.
158165
*/
159166
export const Disabled = Template.bind({});
160167
Disabled.tags = ["!dev"];
@@ -167,10 +174,10 @@ Disabled.parameters = {
167174
};
168175

169176
/**
170-
* The optional quiet style for accordion has no dividers between sections. This style works best when a clear layout
171-
* (vertical stack, table, grid) makes it easy see and understand. Too many quiet components in a small space can be
172-
* hard to differentiate. This can be applied by adding the `spectrum-Accordion--quiet` class alongside the
173-
* parent `spectrum-Accordion` class.
177+
* The optional quiet style for accordion has no dividers between sections. This style works best
178+
* when a clear layout (vertical stack, table, grid) makes it easy to see and understand because
179+
* too many quiet components in a small space can be hard to differentiate. This can be applied by
180+
* adding the `.spectrum-Accordion--quiet` class alongside the parent `.spectrum-Accordion` class.
174181
*/
175182
export const Quiet = Template.bind({});
176183
Quiet.tags = ["!dev"];
@@ -183,11 +190,13 @@ Quiet.parameters = {
183190
};
184191

185192
/**
186-
* The optional no inline padding style for accordion. This sets no overall horizontal padding on either side of the component
187-
* (but the body text content always keeps its own padding from the edge). This can be applied by adding the `spectrum-Accordion--noInlinePadding` class alongside the
188-
* parent `spectrum-Accordion` class.
193+
* Implementations may choose to remove inline padding from the accordion item headers by adding
194+
* the `.spectrum-Accordion--noInlinePadding` class alongside the parent `.spectrum-Accordion`
195+
* class. Accordion item header padding will be removed, but the body text content will keep its
196+
* own padding from the edge.
189197
*/
190198
export const NoInlinePadding = Template.bind({});
199+
NoInlinePadding.storyName = "No inline padding";
191200
NoInlinePadding.tags = ["!dev"];
192201
NoInlinePadding.args = {
193202
items: accordionContent,
@@ -198,7 +207,8 @@ NoInlinePadding.parameters = {
198207
};
199208

200209
/**
201-
* Each of the different sizes have varying font sizes, and tighter or looser vertical spacing between the rows. Medium is the default size.
210+
* Each of the different sizes has varying font sizes, and varying vertical spacing between the
211+
* rows. Medium is the default size.
202212
*/
203213
export const Sizing = (args, context) => Sizes({
204214
Template,

0 commit comments

Comments
 (0)