storybook-addon-sdc 0.12.2 → 0.12.3
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 +29 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ This addon streamlines the integration of Drupal Single Directory Components (SD
|
|
|
17
17
|
- [Regular Storybook](#regular-storybook)
|
|
18
18
|
- [Configuration Options](#configuration-options)
|
|
19
19
|
- [Setting Default Values](#setting-default-values)
|
|
20
|
+
- [Disable Basic Story](#disable-basic-story)
|
|
20
21
|
- [Why Choose SDC Storybook Over Alternatives?](#why-choose-sdc-storybook-over-alternatives)
|
|
21
22
|
- [Dependencies](#dependencies)
|
|
22
23
|
- [Known Issues](#known-issues)
|
|
@@ -346,6 +347,23 @@ And in story definitions within YAML files:
|
|
|
346
347
|
],
|
|
347
348
|
```
|
|
348
349
|
|
|
350
|
+
- **Non Component Namespaces**: If you want to use components from a directory that does not follow the SDC structure (i.e., does not have a `components` directory), you can define a namespace that points directly to that directory. For example, if you have an `assets` directory with SVG icons:
|
|
351
|
+
|
|
352
|
+
```js
|
|
353
|
+
sdcStorybookOptions: {
|
|
354
|
+
namespaces: {
|
|
355
|
+
'assets': join(cwd(), './assets'),
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
In this case, the addon will look for components directly in the specified directory.
|
|
361
|
+
And you can use them in twig and stories as usual:
|
|
362
|
+
|
|
363
|
+
```twig
|
|
364
|
+
{% include '@assets/icons/example.svg' %}
|
|
365
|
+
```
|
|
366
|
+
|
|
349
367
|
## Regular storybook
|
|
350
368
|
|
|
351
369
|
All Storybook functions work as usual, and you can import SDC YAML into `.stories.js` files.
|
|
@@ -536,6 +554,17 @@ Refer to:
|
|
|
536
554
|
- [Drupal SDC Documentation](https://www.drupal.org/docs/develop/theming-drupal/using-single-directory-components/annotated-example-componentyml)
|
|
537
555
|
- [JSON Schema Documentation](https://json-schema.org/understanding-json-schema/reference/annotations)
|
|
538
556
|
|
|
557
|
+
## Disable Basic Story
|
|
558
|
+
|
|
559
|
+
By default the addon generates a `Basic` story for each component using default props and slots. This is useful for quickly previewing components, but if you prefer to create your own stories exclusively, you can disable this feature.
|
|
560
|
+
To disable the automatic generation of the `Basic` story, set `disableBasicStory: true` in your component YAML:
|
|
561
|
+
|
|
562
|
+
```yaml
|
|
563
|
+
thirdPartySettings:
|
|
564
|
+
sdcStorybook:
|
|
565
|
+
disableBasicStory: true
|
|
566
|
+
```
|
|
567
|
+
|
|
539
568
|
## Why Choose SDC Storybook Over Alternatives?
|
|
540
569
|
|
|
541
570
|
While solutions like [SDC Styleguide](https://www.drupal.org/project/sdc_styleguide) and [Drupal Storybook](https://www.drupal.org/project/storybook) are valuable, the SDC Storybook addon offers distinct advantages:
|