@kadira/react-storybook-addon-info
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -32,19 +32,17 @@ 'use strict'; | ||
addWithInfo: function addWithInfo(storyName, info, storyFn, _options) { | ||
if (typeof storyFn !== 'function') { | ||
if (typeof info === 'function') { | ||
_options = storyFn; | ||
storyFn = info; | ||
info = ''; | ||
} else { | ||
throw new Error('No story defining function has been specified'); | ||
} | ||
} | ||
var options = (0, _extends3.default)({}, defaultOptions, _options); | ||
this.add(storyName, function (context) { | ||
var _info = info; | ||
var _storyFn = storyFn; | ||
if (typeof storyFn !== 'function') { | ||
if (typeof info === 'function') { | ||
_storyFn = info; | ||
_info = ''; | ||
} else { | ||
throw new Error('No story defining function has been specified'); | ||
} | ||
} | ||
var props = { | ||
_info: _info, | ||
info: info, | ||
context: context, | ||
@@ -60,3 +58,3 @@ showInline: Boolean(options.inline), | ||
props, | ||
_storyFn(context) | ||
storyFn(context) | ||
); | ||
@@ -63,0 +61,0 @@ }); |
{ | ||
"name": "@kadira/react-storybook-addon-info", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "A React Storybook addon to show additional information for your stories.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -13,2 +13,12 @@ import React from 'react'; | ||
addWithInfo(storyName, info, storyFn, _options) { | ||
if (typeof storyFn !== 'function') { | ||
if (typeof info === 'function') { | ||
_options = storyFn; | ||
storyFn = info; | ||
info = ''; | ||
} else { | ||
throw new Error('No story defining function has been specified'); | ||
} | ||
} | ||
const options = { | ||
@@ -18,18 +28,6 @@ ...defaultOptions, | ||
}; | ||
this.add(storyName, (context) => { | ||
let _info = info; | ||
let _storyFn = storyFn; | ||
if (typeof storyFn !== 'function') { | ||
if (typeof info === 'function') { | ||
_storyFn = info; | ||
_info = ''; | ||
} else { | ||
throw new Error('No story defining function has been specified'); | ||
} | ||
} | ||
const props = { | ||
_info, | ||
info, | ||
context, | ||
@@ -44,3 +42,3 @@ showInline: Boolean(options.inline), | ||
<Story {...props}> | ||
{_storyFn(context)} | ||
{storyFn(context)} | ||
</Story> | ||
@@ -47,0 +45,0 @@ ); |
375253
2438