storybook-addon-sdc 0.14.1 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@ This addon streamlines the integration of Drupal Single Directory Components (SD
|
|
|
14
14
|
- [Creating Experimental Stories](#creating-experimental-stories)
|
|
15
15
|
- [Support for Single Story Files (\*.story.yml)](#support-for-single-story-files-storyyml)
|
|
16
16
|
- [Namespaces](#namespaces)
|
|
17
|
+
- [Advanced Grouping and Nesting](#advanced-grouping-and-nesting)
|
|
17
18
|
- [Regular Storybook](#regular-storybook)
|
|
18
19
|
- [Configuration Options](#configuration-options)
|
|
19
20
|
- [Setting Default Values](#setting-default-values)
|
|
@@ -368,6 +369,34 @@ And in story definitions within YAML files:
|
|
|
368
369
|
{% include '@assets/icons/example.svg' %}
|
|
369
370
|
```
|
|
370
371
|
|
|
372
|
+
## Advanced Grouping and Nesting
|
|
373
|
+
|
|
374
|
+
By default, the addon organizes all SDC stories under a single **SDC** [Folder](https://storybook.js.org/docs/writing-stories/naming-components-and-hierarchy#structure-and-hierarchy) at the Storybook root.
|
|
375
|
+
|
|
376
|
+
### Grouping by SDC Properties
|
|
377
|
+
|
|
378
|
+
If your SDC component includes a [group property](https://www.drupal.org/docs/develop/theming-drupal/using-single-directory-components/annotated-example-componentyml), such as `group: Navigation`, the addon will automatically create a corresponding folder in Storybook and place the component’s stories within it.
|
|
379
|
+
|
|
380
|
+
**Note:** The `group` property has higher priority over directory structure when determining story placement.
|
|
381
|
+
|
|
382
|
+
### Directory-Based Nesting
|
|
383
|
+
|
|
384
|
+
When your SDC components has nesting structure in the filesystem, the addon will replicate this structure in Storybook. For example, the following atomic directory structure:
|
|
385
|
+
|
|
386
|
+
```
|
|
387
|
+
components/
|
|
388
|
+
atoms/
|
|
389
|
+
button/
|
|
390
|
+
button.component.yml
|
|
391
|
+
icon/
|
|
392
|
+
icon.component.yml
|
|
393
|
+
molecules/
|
|
394
|
+
card/
|
|
395
|
+
card.component.yml
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
will result in nested folders in Storybook, mirroring the organization of your components.
|
|
399
|
+
|
|
371
400
|
## Regular storybook
|
|
372
401
|
|
|
373
402
|
All Storybook functions work as usual, and you can import SDC YAML into `.stories.js` files.
|
|
@@ -560,7 +589,7 @@ Refer to:
|
|
|
560
589
|
|
|
561
590
|
## Story Configuration via `thirdPartySettings.sdcStorybook`
|
|
562
591
|
|
|
563
|
-
The **sdc-addon** now supports configuring how stories are generated from your `component.yml` file.
|
|
592
|
+
The **sdc-addon** now supports configuring how stories are generated from your `component.yml` file.
|
|
564
593
|
You can use the new key `thirdPartySettings.sdcStorybook` to define Storybook-specific settings and control which stories are created.
|
|
565
594
|
|
|
566
595
|
### Example
|