mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
[@storybook/addon-options] Add withOptions
This commit is contained in:
+7
@@ -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"
|
||||
})
|
||||
);
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user