[storybook] Fix Presentation Utility to use default setup; add README note (#122140)

* [storybook] Fix Presentation Utility to use default setup; add README note

* Fix typo

Fix typo
This commit is contained in:
Clint Andrew Hall 2021-12-29 22:32:36 -05:00 committed by GitHub
parent 6ca947b1e1
commit a4d4b3d8b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 15 deletions

View file

@ -16,6 +16,7 @@ This package provides ability to add [Storybook](https://storybook.js.org/) to a
```
- Add your plugin alias to `src/dev/storybook/aliases.ts` config.
- Create sample Storybook stories. For example, in your plugin create a file at
`src/plugins/<plugin>/public/components/hello_world/hello_world.stories.tsx` with
the following [Component Story Format](https://storybook.js.org/docs/react/api/csf) contents:
@ -34,8 +35,20 @@ This package provides ability to add [Storybook](https://storybook.js.org/) to a
```
- Launch Storybook with `yarn storybook <plugin>`, or build a static site with `yarn storybook --site <plugin>`.
## Customizing configuration
The `defaultConfig` object provided by the @kbn/storybook package should be all you need to get running, but you can
override this in your .storybook/main.js. Using [Storybook's configuration options](https://storybook.js.org/docs/react/configure/overview).
The `defaultConfig` object provided by the `@kbn/storybook` package should be all you need to get running, but you can
override this in your `.storybook/main.js`. Using [Storybook's configuration options](https://storybook.js.org/docs/react/configure/overview).
You can also add a `manager.ts` file to customize various aspects of your Storybook. For example, to change the title and link of the Storybook sidebar, you could add:
```ts
addons.setConfig({
theme: create({
brandTitle: 'My Plugin',
brandUrl: 'https://github.com/elastic/kibana/tree/main/src/plugins/my_plugin',
}),
});
```
Refer to the [Storybook documentation](https://storybook.js.org/docs/react/configure/features-and-behavior) for more information.

View file

@ -6,11 +6,6 @@
* Side Public License, v 1.
*/
import { defaultConfigWebFinal } from '@kbn/storybook';
import { defaultConfig } from '@kbn/storybook';
// We have to do this because the kbn/storybook preset overrides the manager entries,
// so we can't customize the theme.
module.exports = {
...defaultConfigWebFinal,
addons: ['@storybook/addon-a11y', '@storybook/addon-essentials'],
};
module.exports = defaultConfig;

View file

@ -10,9 +10,6 @@ import { addons } from '@storybook/addons';
import { create } from '@storybook/theming';
import { PANEL_ID } from '@storybook/addon-actions';
// @ts-expect-error There's probably a better way to do this.
import { registerThemeSwitcherAddon } from '@kbn/storybook/target_node/lib/register_theme_switcher_addon';
addons.setConfig({
theme: create({
base: 'light',
@ -22,5 +19,3 @@ addons.setConfig({
showPanel: true.valueOf,
selectedPanel: PANEL_ID,
});
registerThemeSwitcherAddon();