Skip to content

Commit

Permalink
fix: decorator wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Apr 25, 2020
1 parent 8de3294 commit e2172c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/storybook-6-no-docs/.storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { addParameters, addDecorator } from '@storybook/react';
import { ThemeProvider } from '@component-controls/storybook';

addDecorator(story => (
<ThemeProvider><div id='my-story-wrapper'>{story()}</div></ThemeProvider>
<ThemeProvider>{story()}</ThemeProvider>
));
const categories = ['Storybook', 'Blocks', 'Editors', 'Components']
addParameters({
Expand Down
6 changes: 2 additions & 4 deletions ui/blocks/src/Story/Story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const Story: FC<StoryProps> = (props: StoryProps) => (
if (story && story.renderFn) {
try {
const values = story.controls ? getControlValues(story.controls) : {};
const { decorators_XXX: globalDecorators = [] } = options;
const { decorators: globalDecorators = [] } = options;
const { decorators: storyDecorators = [] } = story;
const decorators = deepMerge(globalDecorators, storyDecorators);
const renderFn = decorators.reduce(
Expand All @@ -28,9 +28,7 @@ export const Story: FC<StoryProps> = (props: StoryProps) => (
);
return (
<Box id={story.id} sx={{ px: 3 }} {...rest}>
<div style={{ all: 'unset' }}>
{createElement('div', null, renderFn())}
</div>
<div style={{ all: 'unset' }}>{createElement(renderFn)}</div>
</Box>
);
} catch (e) {
Expand Down

0 comments on commit e2172c8

Please sign in to comment.