Skip to content

Commit

Permalink
Add getStoryBook function
Browse files Browse the repository at this point in the history
  • Loading branch information
thani-sh committed Jul 26, 2016
1 parent 880d3ba commit 86d5819
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 3 deletions.
5 changes: 3 additions & 2 deletions dist/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.configure = exports.addDecorator = exports.setAddon = exports.linkTo = exports.action = exports.storiesOf = undefined;
exports.getStoryBook = exports.configure = exports.addDecorator = exports.setAddon = exports.linkTo = exports.action = exports.storiesOf = undefined;

var _preview = require('./preview');

Expand All @@ -16,4 +16,5 @@ var action = exports.action = previewApi.action;
var linkTo = exports.linkTo = previewApi.linkTo;
var setAddon = exports.setAddon = previewApi.setAddon;
var addDecorator = exports.addDecorator = previewApi.addDecorator;
var configure = exports.configure = previewApi.configure;
var configure = exports.configure = previewApi.configure;
var getStoryBook = exports.getStoryBook = previewApi.getStoryBook;
13 changes: 13 additions & 0 deletions dist/client/preview/client_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,19 @@ var ClientApi = function () {
}
};
}
}, {
key: 'getStoryBook',
value: function getStoryBook() {
var _this2 = this;

return this._storyStore.getStoryKinds().map(function (kind) {
var stories = _this2._storyStore.getStories(kind).map(function (name) {
var render = _this2._storyStore.getStory(kind, name);
return { name: name, render: render };
});
return { kind: kind, stories: stories };
});
}
}]);
return ClientApi;
}();
Expand Down
3 changes: 2 additions & 1 deletion dist/client/preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.configure = exports.clearDecorators = exports.addDecorator = exports.setAddon = exports.linkTo = exports.action = exports.storiesOf = undefined;
exports.configure = exports.getStoryBook = exports.clearDecorators = exports.addDecorator = exports.setAddon = exports.linkTo = exports.action = exports.storiesOf = undefined;

var _assign = require('babel-runtime/core-js/object/assign');

Expand Down Expand Up @@ -72,6 +72,7 @@ var linkTo = exports.linkTo = clientApi.linkTo.bind(clientApi);
var setAddon = exports.setAddon = clientApi.setAddon.bind(clientApi);
var addDecorator = exports.addDecorator = clientApi.addDecorator.bind(clientApi);
var clearDecorators = exports.clearDecorators = clientApi.clearDecorators.bind(clientApi);
var getStoryBook = exports.getStoryBook = clientApi.getStoryBook.bind(clientApi);
var configure = exports.configure = configApi.configure.bind(configApi);

// initialize the UI
Expand Down
1 change: 1 addition & 0 deletions src/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export const linkTo = previewApi.linkTo;
export const setAddon = previewApi.setAddon;
export const addDecorator = previewApi.addDecorator;
export const configure = previewApi.configure;
export const getStoryBook = previewApi.getStoryBook;
10 changes: 10 additions & 0 deletions src/client/preview/client_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,14 @@ export default class ClientApi {
}
};
}

getStoryBook() {
return this._storyStore.getStoryKinds().map(kind => {
const stories = this._storyStore.getStories(kind).map(name => {
const render = this._storyStore.getStory(kind, name);
return { name, render };
});
return { kind, stories };
});
}
}
1 change: 1 addition & 0 deletions src/client/preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const linkTo = clientApi.linkTo.bind(clientApi);
export const setAddon = clientApi.setAddon.bind(clientApi);
export const addDecorator = clientApi.addDecorator.bind(clientApi);
export const clearDecorators = clientApi.clearDecorators.bind(clientApi);
export const getStoryBook = clientApi.getStoryBook.bind(clientApi);
export const configure = configApi.configure.bind(configApi);

// initialize the UI
Expand Down

0 comments on commit 86d5819

Please sign in to comment.