forked from storybookjs/storybook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request storybookjs#18214 from storybookjs/chore_docs_upda…
…te_sidebar_csf3_auto_title Chore: (Docs) Adds CSF 3.0 docs on auto title feature
- Loading branch information
Showing
8 changed files
with
119 additions
and
29 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
16 changes: 16 additions & 0 deletions
16
docs/snippets/common/component-story-auto-title.csf3-story.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
```js | ||
// src/components/MyComponent.stories.js|jsx | ||
|
||
import { MyComponent } from './MyComponent'; | ||
|
||
/** | ||
* Story written in CSF 3.0 with auto title generation | ||
* See https://storybook.js.org/docs/7.0/react/api/csf | ||
* to learn more about it. | ||
*/ | ||
export default { component: MyComponent }; | ||
|
||
export const Default = { | ||
args: { message: 'Hello world!' }, | ||
}; | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
docs/snippets/common/storybook-csf-3-auto-title-redundant.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
```js | ||
// components/MyComponent/MyComponent.stories.js|jsx|ts|tsx | ||
|
||
import { MyComponent } from './MyComponent.js' | ||
|
||
export default { | ||
component: MyComponent, | ||
title: 'components/MyComponent/MyComponent', | ||
}; | ||
|
||
export const Default = { | ||
args: { | ||
something: 'Something else', | ||
}, | ||
}; | ||
|
||
``` |
15 changes: 15 additions & 0 deletions
15
docs/snippets/common/storybook-main-auto-title-custom.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
```js | ||
// .storybook/main.js | ||
|
||
module.exports = { | ||
stories: [{ directory: '../src', titlePrefix: 'Custom' }], | ||
addons: [ | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@storybook/addon-interactions', | ||
], | ||
core: { | ||
builder: 'webpack5', | ||
}, | ||
}; | ||
``` |
15 changes: 15 additions & 0 deletions
15
docs/snippets/common/storybook-main-configuration-src-dir.main-js.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
```js | ||
// ./storybook/main.js | ||
|
||
module.exports = { | ||
stories: ['../src'], | ||
addons: [ | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@storybook/addon-interactions', | ||
], | ||
core: { | ||
builder: 'webpack5' | ||
}, | ||
}; | ||
``` |
13 changes: 13 additions & 0 deletions
13
docs/snippets/common/storybook-manager-render-label-stories.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
```js | ||
// .storybook/manager.js | ||
|
||
import { addons } from '@storybook/addons'; | ||
|
||
import startCase from 'lodash/startCase'; | ||
|
||
addons.setConfig({ | ||
sidebar: { | ||
renderLabel: ({ name, type }) => (type === 'story' ? name : startCase(name)), | ||
}, | ||
}); | ||
``` |