diff --git a/addons/cssresources/README.md b/addons/cssresources/README.md
index bdc7fe79efc9..31bd40fb2d41 100644
--- a/addons/cssresources/README.md
+++ b/addons/cssresources/README.md
@@ -28,26 +28,27 @@ You need add the all the css resources at compile time using the `withCssResourc
```js
// Import from @storybook/X where X is your framework
-import { configure, addDecorator, storiesOf } from '@storybook/react';
+import { configure, addDecorator, addParameters, storiesOf } from '@storybook/react';
import { withCssResources } from '@storybook/addon-cssresources';
// global
-addDecorator(
- withCssResources({
- cssresources: [{
- id: `bluetheme`,
- code: ``,
- picked: false,
- },
- ],
- })
-);
+addDecorator(withCssResources)
+addParameters({
+ cssresources: [{
+ id: `bluetheme`,
+ code: ``,
+ picked: false,
+ },
+ ],
+});
+
+You can use the `cssresources` parameter to override resources on each story individually:
// per story
storiesOf('Addons|Cssresources', module)
- .addDecorator(
- withCssResources({
- cssresources: [{
+ .add('Camera Icon', () => Camera Icon, {
+ cssresources: [
+ {
id: `fontawesome`,
code: ``,
picked: true,
@@ -57,7 +58,5 @@ storiesOf('Addons|Cssresources', module)
picked: true,
},
],
- })
- )
- .add('Camera Icon', () => Camera Icon);
+ });
```
diff --git a/addons/cssresources/src/css-resource-panel.tsx b/addons/cssresources/src/css-resource-panel.tsx
index 76bf7544e68a..874b36204558 100644
--- a/addons/cssresources/src/css-resource-panel.tsx
+++ b/addons/cssresources/src/css-resource-panel.tsx
@@ -1,6 +1,6 @@
import React, { Component, Fragment } from 'react';
import { SyntaxHighlighter } from '@storybook/components';
-import Eventtypes, { STORY_CHANGED } from '@storybook/core-events';
+import Eventtypes, { STORY_RENDERED } from '@storybook/core-events';
import { EVENTS, PARAM_KEY } from './constants';
import { CssResource } from './CssResource';
@@ -32,12 +32,12 @@ export class CssResourcePanel extends Component {
diff --git a/addons/notes/src/Panel.tsx b/addons/notes/src/Panel.tsx
index 66fe96fdade7..6d26eec6639c 100644
--- a/addons/notes/src/Panel.tsx
+++ b/addons/notes/src/Panel.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import * as PropTypes from 'prop-types';
import { types } from '@storybook/addons';
import { styled } from '@storybook/theming';
-import { STORY_CHANGED } from '@storybook/core-events';
+import { STORY_RENDERED } from '@storybook/core-events';
import { SyntaxHighlighter as SyntaxHighlighterBase, Placeholder } from '@storybook/components';
import Giphy from './giphy';
@@ -73,12 +73,12 @@ export default class NotesPanel extends React.Component
componentDidMount() {
const { api } = this.props;
- api.on(STORY_CHANGED, this.onStoryChange);
+ api.on(STORY_RENDERED, this.onStoryChange);
}
componentWillUnmount() {
const { api } = this.props;
- api.off(STORY_CHANGED, this.onStoryChange);
+ api.off(STORY_RENDERED, this.onStoryChange);
}
onStoryChange = (id: string) => {
diff --git a/docs/src/pages/addons/writing-addons/index.md b/docs/src/pages/addons/writing-addons/index.md
index c4a15cdedf46..f4037104b5d5 100644
--- a/docs/src/pages/addons/writing-addons/index.md
+++ b/docs/src/pages/addons/writing-addons/index.md
@@ -73,13 +73,13 @@ class MyPanel extends React.Component {
componentDidMount() {
const { api } = this.props;
- api.on(STORY_CHANGED, this.onStoryChange);
+ api.on(STORY_RENDERED, this.onStoryChange);
}
componentWillUnmount() {
const { api } = this.props;
- api.off(STORY_CHANGED, this.onStoryChange);
+ api.off(STORY_RENDERED, this.onStoryChange);
}
onStoryChange = id => {
@@ -184,12 +184,12 @@ class MyPanel extends React.Component {
componentDidMount() {
const { api } = this.props;
api.on('foo/doSomeAction', this.onSomeAction);
- api.on(STORY_CHANGED, this.onStoryChange);
+ api.on(STORY_RENDERED this.onStoryChange);
}
componentWillUnmount() {
const { api } = this.props;
api.off('foo/doSomeAction', this.onSomeAction);
- api.off(STORY_CHANGED, this.onStoryChange);
+ api.off(STORY_RENDERED, this.onStoryChange);
}
render() {