Skip to content

Commit

Permalink
chore(storybook): pass function to playground
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour committed Mar 14, 2019
1 parent a629f7a commit b3745e5
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions .storybook/decorators.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { action } from '@storybook/addon-actions';
import algoliasearch from 'algoliasearch/lite';
import instantsearch from '../src/index';
import moviesPlayground from './playgrounds/movies';
import defaultPlayground from './playgrounds/default';

export const withHits = (
Expand All @@ -21,7 +20,7 @@ export const withHits = (
apiKey = '6be0576ff61c053d5f9a3225e2a90f76',
indexName = 'instant_search',
searchParameters = {},
playground = 'default',
playground = defaultPlayground,
...instantsearchOptions
} = searchOptions || {};

Expand Down Expand Up @@ -68,23 +67,11 @@ export const withHits = (
rightPanelPlaygroundElement.classList.add('panel-right');
playgroundElement.appendChild(rightPanelPlaygroundElement);

switch (playground) {
case 'movies': {
moviesPlayground({
search,
leftPanel: leftPanelPlaygroundElement,
rightPanel: rightPanelPlaygroundElement,
});
break;
}
default: {
defaultPlayground({
search,
leftPanel: leftPanelPlaygroundElement,
rightPanel: rightPanelPlaygroundElement,
});
}
}
playground({
search,
leftPanel: leftPanelPlaygroundElement,
rightPanel: rightPanelPlaygroundElement,
});

storyFn({
container: previewElement,
Expand Down

0 comments on commit b3745e5

Please sign in to comment.