Skip to content

Commit

Permalink
Add migration instructions for isToolshown rename
Browse files Browse the repository at this point in the history
  • Loading branch information
shilman committed May 9, 2022
1 parent 99f3070 commit aad962b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
16 changes: 16 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- [From version 6.4.x to 6.5.0](#from-version-64x-to-650)
- [React18 new root API](#react18-new-root-api)
- [Renamed isToolshown to showToolbar](#renamed-istoolshown-to-showtoolbar)
- [Deprecated register.js](#deprecated-registerjs)
- [Dropped support for addon-actions addDecorators](#dropped-support-for-addon-actions-adddecorators)
- [Vite builder renamed](#vite-builder-renamed)
Expand Down Expand Up @@ -213,6 +214,21 @@ module.exports = {
};
```

### Renamed isToolshown to showToolbar

Storybook's [manager API](docs/addons/addons-api.md) has deprecated the `isToolshown` option (to show/hide the toolbar) and renamed it to `showToolbar` for consistency with other similar UI options.

Example:

```js
// .storybook/manager.js
import { addons } from '@storybook/addons';

addons.setConfig({
showToolbar: false,
});
```

### Deprecated register.js

In ancient versions of Storybook, addons were registered by referring to `addon-name/register.js`. This is going away in SB7.0. Instead you should just add `addon-name` to the `addons` array in `.storybook/main.js`.
Expand Down
12 changes: 6 additions & 6 deletions docs/snippets/common/storybook-config-layout.js.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ addons.setConfig({
collapsedRoots: ['other'],
},
toolbar: {
title: { hidden: false, },
zoom: { hidden: false, },
eject: { hidden: false, },
copy: { hidden: false, },
fullscreen: { hidden: false, },
title: { hidden: false },
zoom: { hidden: false },
eject: { hidden: false },
copy: { hidden: false },
fullscreen: { hidden: false },
},
});
```
```
12 changes: 11 additions & 1 deletion lib/api/src/modules/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import pick from 'lodash/pick';
import deepEqual from 'fast-deep-equal';
import { themes } from '@storybook/theming';
import type { ThemeVars } from '@storybook/theming';
import { once } from '@storybook/client-logger';
import dedent from 'ts-dedent';

import merge from '../lib/merge';
import type { State, ModuleFn } from '../index';
Expand All @@ -25,7 +27,10 @@ export interface Layout {
showNav: boolean;
showTabs: boolean;
showToolbar: boolean;
isToolshown?: boolean; // deprecated
/**
* @deprecated
*/
isToolshown?: boolean;
}

export interface UI {
Expand Down Expand Up @@ -222,6 +227,11 @@ export const init: ModuleFn = ({ store, provider, singleStory }) => {
const { theme, selectedPanel, ...options } = provider.getConfig();

if (options?.layout?.isToolshown !== undefined) {
once.warn(dedent`
The "isToolshown" option is deprecated. Please use "showToolbar" instead.
See https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#renamed-istoolshown-to-showtoolbar
`);
options.layout.showToolbar = options.layout.isToolshown;
}

Expand Down

0 comments on commit aad962b

Please sign in to comment.