storybook-addon-sdc 0.24.4 → 0.24.6
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 +18 -6
- package/dist/preset.js +872 -831
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -180,7 +180,7 @@ The addon dynamically renders the components and stories as defined:
|
|
|
180
180
|
|
|
181
181
|
## Core and custom story node types
|
|
182
182
|
|
|
183
|
-
Plugin supports
|
|
183
|
+
Plugin supports these core story node types: `component`, `element`, `image`, and `icon`.
|
|
184
184
|
|
|
185
185
|
Use `component` to nest other components within your story.
|
|
186
186
|
|
|
@@ -232,13 +232,25 @@ thirdPartySettings:
|
|
|
232
232
|
class: 'custom-class'
|
|
233
233
|
```
|
|
234
234
|
|
|
235
|
+
Use `icon` to render an icon from the [Drupal Icon API](#drupal-icon-api). It is
|
|
236
|
+
a built-in node type — `{ pack_id, icon_id }` is rendered through the same
|
|
237
|
+
pipeline as the `icon()` Twig function (inline SVG, recolorable):
|
|
238
|
+
|
|
239
|
+
```yaml
|
|
240
|
+
- type: icon
|
|
241
|
+
pack_id: my_svg
|
|
242
|
+
icon_id: star
|
|
243
|
+
settings:
|
|
244
|
+
color: '#e53935'
|
|
245
|
+
```
|
|
246
|
+
|
|
235
247
|
### You can add custom renderers for additional `story` node types.
|
|
236
248
|
|
|
237
|
-
For example, to render a custom `
|
|
249
|
+
For example, to render a custom `youtube` type:
|
|
238
250
|
|
|
239
251
|
```yaml
|
|
240
|
-
- type:
|
|
241
|
-
|
|
252
|
+
- type: youtube
|
|
253
|
+
id: aqz-KE-bpKQ
|
|
242
254
|
```
|
|
243
255
|
|
|
244
256
|
Add the following to your `sdcStorybookOptions`:
|
|
@@ -248,10 +260,10 @@ sdcStorybookOptions: {
|
|
|
248
260
|
...
|
|
249
261
|
storyNodesRenderer: [
|
|
250
262
|
{
|
|
251
|
-
appliesTo: item => item?.type === '
|
|
263
|
+
appliesTo: item => item?.type === 'youtube',
|
|
252
264
|
render: item =>
|
|
253
265
|
JSON.stringify(
|
|
254
|
-
`<
|
|
266
|
+
`<iframe src="https://www.youtube.com/embed/${item.id}" allowfullscreen></iframe>`
|
|
255
267
|
),
|
|
256
268
|
priority: -4,
|
|
257
269
|
},
|