Skip to content

Commit

Permalink
fix: changes Story
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Mar 27, 2020
1 parent ff76d4b commit 018e453
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
22 changes: 8 additions & 14 deletions examples/storybook-5/.storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,27 @@ addDecorator((story, ctx ) => {
);
})

export const DocsPage = ({
titleSlot,
subtitleSlot,
descriptionSlot,
propsSlot,
storiesSlot,
}) => {
export const DocsPage = () => {
return (
<BlockContextProvider>
<SBTitle slot={titleSlot} />
<Title slot={titleSlot} />
<Subtitle slot={subtitleSlot} />
<SBDescription slot={descriptionSlot} />
<Description slot={descriptionSlot} />
<SBTitle />
<Title />
<Subtitle />
<SBDescription />
<Description />
<ComponentSource id="." title='Component source' />
<Story id="." />
<SBStory id="." />
<StorySource id="." title='Story source'/>
<ControlsTable id="." />
<PropsTable of="." />
<Props slot={propsSlot} />
<Props />
<Playground>
<Story id="." />
</Playground>
<DependenciesTable titleDependencies='Dependencies' titleDependents='Dependents' />
<Stories />
<SBStories slot={storiesSlot} />
<SBStories />
</BlockContextProvider>
);
};
Expand Down
1 change: 0 additions & 1 deletion ui/blocks/src/Stories/plain/Stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export const Stories: FC<StoriesProps> = ({ id, name, ...rest }) => {
if (!stories || !stories.length) {
return null;
}
console.log(stories);
return (
<div>
{stories.map(story => (
Expand Down
23 changes: 18 additions & 5 deletions ui/blocks/src/Story/Story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,22 @@ export const Story: FC<StoryProps> = ({ id, name, ...rest }) => {
id,
name,
});
return story && story.renderFn ? (
<div id={story.id} {...rest}>
{createElement(story.renderFn)}
</div>
) : null;

if (story && story.renderFn) {
let children;
try {
children = createElement(story.renderFn);
} catch (e) {
console.log(e);
}
console.log(children);
if (children) {
return (
<div id={story.id} {...rest}>
{children}
</div>
);
}
}
return null;
};

0 comments on commit 018e453

Please sign in to comment.