From 9ba9daa98efb06835d8dac4a320050bc12113eb6 Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Mon, 4 Mar 2019 13:34:24 +0000 Subject: [PATCH] Add MIGRATION.md entry for addon-cssresources 5.x attribute change --- MIGRATION.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/MIGRATION.md b/MIGRATION.md index a9139dcf454e..1f61a95ee90d 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -6,6 +6,7 @@ - [Options addon deprecated](#options-addon-deprecated) - [Individual story decorators](#individual-story-decorators) - [Addon backgrounds uses parameters](#addon-backgrounds-uses-parameters) + - [Addon cssresources name attribute renamed](#addon-cssresources-name-attribute-renamed) - [Addon viewport uses parameters](#addon-viewport-uses-parameters) - [Addon a11y uses parameters](#addon-a11y-uses-parameters-decorator-renamed) - [New keyboard shortcuts defaults](#new-keyboard-shortcuts-defaults) @@ -187,6 +188,46 @@ storiesOf('Stories', module).addParameters({ backgrounds: options }); You can pass `backgrounds` parameters at the global level (via `addParameters` imported from `@storybook/react` et al.), and the story level (via the third argument to `.add()`). +## Addon cssresources name attribute renamed + +In the options object for `@storybook/addon-cssresources`, the `name` attribute for each resource has been renamed to `id`. If you previously had: + +```js +import { withCssResources } from '@storybook/addon-cssresources'; +import { addDecorator } from '@storybook/react'; + +addDecorator( + withCssResources({ + cssresources: [ + { + name: `bluetheme`, // Previous + code: ``, + picked: false + } + ] + }) +); +``` + +You should replace it with: + +```js +import { withCssResources } from '@storybook/addon-cssresources'; +import { addDecorator } from '@storybook/react'; + +addDecorator( + withCssResources({ + cssresources: [ + { + id: `bluetheme`, // Renamed + code: ``, + picked: false + } + ] + }) +); +``` + ## Addon viewport uses parameters Similarly, `@storybook/addon-viewport` uses parameters to pass viewport options. If you previously had: