[@storybook/addon-options] Add withOptions

This commit is contained in:
Adam Misiorny
2018-12-01 16:01:05 +01:00
parent 8ff7e8f29e
commit 2c5d06c3e8
3 changed files with 29 additions and 2 deletions
+7
View File
@@ -6,6 +6,8 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { StoryDecorator } from "@storybook/react";
export interface Options {
name?: string;
url?: string;
@@ -23,4 +25,9 @@ export interface Options {
selectedAddonPanel?: string;
}
/**
* @deprecated Use withOptions instead
*/
export function setOptions(options: Options): void;
export function withOptions(options: Options): StoryDecorator;
@@ -1,4 +1,5 @@
import { setOptions } from '@storybook/addon-options';
import { setOptions, withOptions } from '@storybook/addon-options';
import { addDecorator } from '@storybook/react';
setOptions({
name: 'My Storybook',
@@ -31,3 +32,19 @@ setOptions({
hierarchySeparator: '.',
hierarchyRootSeparator: '#',
});
addDecorator(
withOptions({
name: "My Storybook",
url: "https://example.com",
goFullScreen: false,
showStoriesPanel: false,
showAddonPanel: false,
showSearchBox: false,
addonPanelInRight: false,
sortStoriesByKind: false,
hierarchySeparator: /\//,
hierarchyRootSeparator: /\|/,
selectedAddonPanel: "storybook/actions/action-panel"
})
);
+4 -1
View File
@@ -15,6 +15,9 @@
"paths": {
"@storybook/addon-options": [
"storybook__addon-options"
],
"@storybook/react": [
"storybook__react"
]
},
"types": [],
@@ -25,4 +28,4 @@
"index.d.ts",
"storybook__addon-options-tests.ts"
]
}
}