Skip to content

Commit

Permalink
Add support for preview-decorators. (#582)
Browse files Browse the repository at this point in the history
* Add support for preview-decorators.

* Fix lint issues.
  • Loading branch information
arunoda authored Oct 28, 2016
1 parent 89ec21b commit e424a38
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
12 changes: 11 additions & 1 deletion dist/client/manager/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,19 @@ var ReactProvider = function (_Provider) {
selectedStory: selectedStory
};

var DefaultPreviewDecorator = function DefaultPreviewDecorator(_ref) {
var children = _ref.children;
return children;
};
var PreviewDecorator = _storybookAddons2.default.getPreviewDecorator() || DefaultPreviewDecorator;

var queryString = _qs2.default.stringify(queryParams);
var url = 'iframe.html?' + queryString;
return _react2.default.createElement(_preview2.default, { url: url });
return _react2.default.createElement(
PreviewDecorator,
null,
_react2.default.createElement(_preview2.default, { url: url })
);
}
}, {
key: 'handleAPI',
Expand Down
Empty file modified dist/server/build.js
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@kadira/react-split-pane": "^1.4.0",
"@kadira/storybook-addon-actions": "^1.0.2",
"@kadira/storybook-addon-links": "^1.0.0",
"@kadira/storybook-addons": "^1.5.0",
"@kadira/storybook-addons": "^1.6.0",
"@kadira/storybook-channel-postmsg": "^1.0.3",
"@kadira/storybook-ui": "^3.6.0",
"airbnb-js-shims": "^1.0.1",
Expand Down
7 changes: 6 additions & 1 deletion src/client/manager/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@ export default class ReactProvider extends Provider {
selectedStory,
};

const DefaultPreviewDecorator = ({ children }) => children;
const PreviewDecorator = addons.getPreviewDecorator() || DefaultPreviewDecorator;

const queryString = qs.stringify(queryParams);
const url = `iframe.html?${queryString}`;
return (
<Preview url={url} />
<PreviewDecorator>
<Preview url={url} />
</PreviewDecorator>
);
}

Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
version "1.0.1"
resolved "https://registry.yarnpkg.com/@kadira/storybook-addon-links/-/storybook-addon-links-1.0.1.tgz#566136a8020b60f82f146ef37d93b0c86de969d8"

"@kadira/storybook-addons@^1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@kadira/storybook-addons/-/storybook-addons-1.5.0.tgz#f92cd2059282a9b4b8bdac4bef28269f85e40be4"
"@kadira/storybook-addons@^1.6.0":
version "1.6.0"
resolved "https://registry.yarnpkg.com/@kadira/storybook-addons/-/storybook-addons-1.6.0.tgz#b47a4076b3e0f4dcba0de4c322ce967e36233059"

"@kadira/storybook-channel-postmsg@^1.0.3":
version "1.0.3"
Expand Down

0 comments on commit e424a38

Please sign in to comment.