Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Commit

Permalink
Merge pull request #37 from FredyC/patch-1
Browse files Browse the repository at this point in the history
Make a description optional
  • Loading branch information
Muhammed Thanish committed Jul 18, 2016
2 parents 5922032 + 8bb7115 commit adbca9b
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,22 @@ export default {
...defaultOptions,
..._options
};

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,
showInline: Boolean(options.inline),
showHeader: Boolean(options.header),
Expand All @@ -27,7 +39,7 @@ export default {

return (
<Story {...props}>
{storyFn(context)}
{_storyFn(context)}
</Story>
);
});
Expand Down

0 comments on commit adbca9b

Please sign in to comment.