mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 05:51:48 +08:00
25 lines
586 B
Plaintext
25 lines
586 B
Plaintext
```js
|
|
// addon-panel/manager.js
|
|
|
|
import React from 'react';
|
|
|
|
import { AddonPanel } from '@storybook/components';
|
|
|
|
import { addons, types } from '@storybook/preview-api';
|
|
|
|
import { useGlobals } from '@storybook/manager-api';
|
|
|
|
addons.register('my/panel', () => {
|
|
addons.add('my-panel-addon/panel', {
|
|
title: 'Example Storybook panel',
|
|
//👇 Sets the type of UI element in Storybook
|
|
type: types.PANEL,
|
|
render: ({ active, key }) => (
|
|
<AddonPanel key="panel" active={isActive}>
|
|
<h2>I'm a panel addon in Storybook</h2>
|
|
</AddonPanel>
|
|
),
|
|
});
|
|
});
|
|
```
|