Storybook: Add internal stories functionality (#23139)

This commit is contained in:
Tobias Skarhed 2020-03-27 14:37:08 +01:00 committed by GitHub
parent 9272c0817c
commit 6d6d86f940
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View File

@ -10,7 +10,7 @@ Storybook is:
## How to create stories
Stories for a component should be placed next to the component file. The Storybook file requires the same name as the component file. For example, a story for `SomeComponent.tsx` will have the file name `SomeComponent.story.tsx`.
Stories for a component should be placed next to the component file. The Storybook file requires the same name as the component file. For example, a story for `SomeComponent.tsx` will have the file name `SomeComponent.story.tsx`. If a story should be internal, not visible in production, name the file `SomeComponent.story.internal.tsx`.
### Writing stories

View File

@ -1,5 +1,11 @@
const stories = ['../src/**/*.story.{js,jsx,ts,tsx,mdx}'];
if (process.env.NODE_ENV !== 'production') {
stories.push('../src/**/*.story.internal.{js,jsx,ts,tsx,mdx}');
}
module.exports = {
stories: ['../src/**/*.story.{js,jsx,ts,tsx,mdx}'],
stories: stories,
addons: [
'@storybook/addon-knobs',
'@storybook/addon-actions',