Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to use info addon as decorator #1592

Merged
merged 5 commits into from
Aug 5, 2017
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions addons/info/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ storiesOf('Component', module)
)
```

## Usage as decorator

It is possible to add infos by default to all components by using a global or story decorator. The drawback is you won't be able to display a distinct info message per story.

It is important to declare this decorator as **the first decorator**, otherwise it won't work well.

```
addDecorator(withInfo()(story => story()));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't the info addon show information on the WrapStory component instead of the actual story component with this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@denkristoffer it could be only if you add other decorators. In this case, it's important to keep the right decorators order.

```

## Global options

To configure default options for all usage of the info option, use `setDefaults` in `.storybook/config.js`:
Expand Down