UNPKG

1.49 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.withMarkdownNotes = exports.withNotes = void 0;
7
8var _addons = require("@storybook/addons");
9
10var _utilDeprecate = _interopRequireDefault(require("util-deprecate"));
11
12function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
14// todo resolve any after @storybook/addons and @storybook/channels are migrated to TypeScript
15var withNotes = (0, _addons.makeDecorator)({
16 name: 'withNotes',
17 parameterName: 'notes',
18 skipIfNoParametersOrOptions: true,
19 allowDeprecatedUsage: true,
20 wrapper: (0, _utilDeprecate["default"])(function (getStory, context, _ref) {
21 var options = _ref.options,
22 parameters = _ref.parameters;
23 var storyOptions = parameters || options;
24
25 var _ref2 = typeof storyOptions === 'string' ? {
26 text: storyOptions,
27 markdown: undefined
28 } : storyOptions,
29 text = _ref2.text,
30 markdown = _ref2.markdown;
31
32 if (!text && !markdown) {
33 throw new Error("Parameter 'notes' must must be a string or an object with 'text' or 'markdown' properties");
34 }
35
36 return getStory(context);
37 }, 'withNotes is deprecated')
38});
39exports.withNotes = withNotes;
40var withMarkdownNotes = (0, _utilDeprecate["default"])(function (text, options) {}, 'withMarkdownNotes is deprecated');
41exports.withMarkdownNotes = withMarkdownNotes;
42
43if (module && module.hot && module.hot.decline) {
44 module.hot.decline();
45}
\No newline at end of file