-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Update multiple components guidance
- Loading branch information
Showing
25 changed files
with
381 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
```ts | ||
// List.stories.ts | ||
import type { Meta, StoryObj } from '@storybook/angular'; | ||
import { moduleMetadata } from '@storybook/angular'; | ||
import { CommonModule } from '@angular/common'; | ||
|
||
import { List } from './list.component'; | ||
import { ListItem } from './list-item.component'; | ||
|
||
//👇 Import the story with a render function from the CSF 3 stories file | ||
import { Unchecked } from './ListItem.stories'; | ||
|
||
const meta: Meta<List> = { | ||
component: List, | ||
decorators: [ | ||
moduleMetadata({ | ||
declarations: [List, ListItem], | ||
imports: [CommonModule], | ||
}), | ||
], | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<List>; | ||
|
||
export const OneItem: Story = { | ||
render: (args) => ({ | ||
props: args, | ||
template: ` | ||
<app-list> | ||
${Unchecked.render({ ...Unchecked.args })} | ||
</app-list> | ||
`, | ||
}), | ||
}; | ||
``` |
8 changes: 1 addition & 7 deletions
8
...nippets/solid/list-story-unchecked.js.mdx → docs/snippets/react/reuse-story-csf2.js.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 1 addition & 7 deletions
8
...ets/react/list-story-unchecked.ts-4-9.mdx → ...nippets/react/reuse-story-csf2.ts-4-9.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 1 addition & 7 deletions
8
...nippets/react/list-story-unchecked.ts.mdx → docs/snippets/react/reuse-story-csf2.ts.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
```js | ||
// List.stories.js|jsx | ||
import { composeStories } from '@storybook/react'; | ||
|
||
import { List } from './List'; | ||
|
||
//👇 Import the stories and their meta from the stories file | ||
import * as stories from './ListItem.stories'; | ||
|
||
// 👇 Compose the story | ||
const { Unchecked } = composeStories(stories); | ||
|
||
export default { | ||
component: List, | ||
}; | ||
|
||
export const OneItem = { | ||
render: (args) => ( | ||
<List {...args}><Unchecked /></List> | ||
), | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
```ts | ||
// List.stories.ts|tsx | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { composeStories } from '@storybook/react'; | ||
|
||
import { List } from './List'; | ||
|
||
//👇 Import the stories and their meta from the stories file | ||
import * as stories from './ListItem.stories'; | ||
|
||
// 👇 Compose the story | ||
const { Unchecked } = composeStories(stories); | ||
|
||
export const meta = { | ||
component: List, | ||
} satisfies Meta<typeof List>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const OneItem: Story = { | ||
render: (args) => ( | ||
<List {...args}><Unchecked /></List> | ||
), | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
```tsx | ||
// List.stories.ts|tsx | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { composeStories } from '@storybook/react'; | ||
|
||
import { List } from './List'; | ||
|
||
//👇 Import the stories and their meta from the stories file | ||
import * as stories from './ListItem.stories'; | ||
|
||
// 👇 Compose the story | ||
const { Unchecked } = composeStories(stories); | ||
|
||
export const meta: Meta<typeof List> = { | ||
component: List, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof List>; | ||
|
||
export const OneItem: Story = { | ||
render: (args) => ( | ||
<List {...args}><Unchecked /></List> | ||
), | ||
}; | ||
``` | ||
|
||
|
||
|
8 changes: 1 addition & 7 deletions
8
...nippets/react/list-story-unchecked.js.mdx → docs/snippets/solid/reuse-story-csf2.js.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 1 addition & 7 deletions
8
...ets/solid/list-story-unchecked.ts-4-9.mdx → ...nippets/solid/reuse-story-csf2.ts-4-9.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 1 addition & 7 deletions
8
...nippets/solid/list-story-unchecked.ts.mdx → docs/snippets/solid/reuse-story-csf2.ts.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
```js | ||
// List.stories.js|jsx | ||
import { List } from './List'; | ||
|
||
//👇 Import the story with a render function from the CSF 3 stories file | ||
import { Unchecked } from './ListItem.stories'; | ||
|
||
export default { | ||
component: List, | ||
}; | ||
|
||
export const OneItem = { | ||
render: (args) => ( | ||
<List {...args}> | ||
{Unchecked.render({...Unchecked.args})} | ||
</List> | ||
), | ||
}; | ||
``` |
24 changes: 24 additions & 0 deletions
24
docs/snippets/solid/reuse-story-render-function.ts-4-9.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
```tsx | ||
// List.stories.ts|tsx | ||
import type { Meta, StoryObj } from 'storybook-solidjs'; | ||
|
||
import { List } from './List'; | ||
|
||
//👇 Import the story with a render function from the CSF 3 stories file | ||
import { Unchecked } from './ListItem.stories'; | ||
|
||
export const meta = { | ||
component: List, | ||
} satisfies Meta<typeof List>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const OneItem: Story = { | ||
render: (args) => ( | ||
<List {...args}> | ||
{Unchecked.render({...Unchecked.args})} | ||
</List> | ||
), | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
```tsx | ||
// List.stories.ts|tsx | ||
import type { Meta, StoryObj } from 'storybook-solidjs'; | ||
|
||
import { List } from './List'; | ||
|
||
//👇 Import the story with a render function from the CSF 3 stories file | ||
import { Unchecked } from './ListItem.stories'; | ||
|
||
export const meta: Meta<typeof List> = { | ||
component: List, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof List>; | ||
|
||
export const OneItem: Story = { | ||
render: (args) => ( | ||
<List {...args}> | ||
{Unchecked.render({...Unchecked.args})}> | ||
</List> | ||
), | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.