forked from storybookjs/storybook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
syntax-context-storiesof.stories.svelte
59 lines (49 loc) · 1.36 KB
/
syntax-context-storiesof.stories.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<script>
import { storiesOf, StoriesOf, Story } from '@storybook/svelte3';
import { linkTo } from '@storybook/addon-links';
storiesOf(module);
</script>
<p>
In Storybook for Svelte 3, <code>storiesOf</code> allows to prebind the
<code>StoriesOf</code> component.
</p>
<pre>{`
<script>
import { storiesOf, StoriesOf, Story } from '@storybook/svelte3';
storiesOf(module);
</script>
<StoriesOf kind="syntax|Context/StoriesOf">
<Story name="first">
First story of first context StoriesOf
</Story>
</StoriesOf>
<StoriesOf kind="syntax|Context/StoriesOf/Another">
<Story name="first">
First story of first context StoriesOf
</Story>
</StoriesOf>
`}</pre>
<p>
It also allows to prebind the
<a href on:click|preventDefault={linkTo('syntax|Context/Story')}>
kind of stories</a>,
making it possible to completely spare the <code>StoriesOf</code> component
in most cases.
</p>
<hr>
<StoriesOf kind="syntax|Context/StoriesOf">
<Story name="first">
First story of the first StoriesOf
</Story>
<Story name="second">
Second story of the first StoriesOf
</Story>
</StoriesOf>
<StoriesOf kind="syntax|Context/StoriesOf/Another">
<Story name="first">
First story of the other StoriesOf
</Story>
<Story name="second">
Second story of the other StoriesOf
</Story>
</StoriesOf>