Skip to content

Commit

Permalink
feat(toggleRefinement): implement InstantSearch.css (algolia#3135)
Browse files Browse the repository at this point in the history
  • Loading branch information
bobylito authored and francoischalifour committed Oct 3, 2018
1 parent 80f2e06 commit d67a437
Show file tree
Hide file tree
Showing 21 changed files with 1,022 additions and 1,368 deletions.
2 changes: 1 addition & 1 deletion dev/app/builtin/init-stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import initSearchBoxStories from './stories/search-box.stories';
import initSortByStories from './stories/sort-by.stories';
import initStarRatingStories from './stories/star-rating.stories';
import initStatsStories from './stories/stats.stories';
import initToggleStories from './stories/toggle.stories';
import initToggleStories from './stories/toggleRefinement.stories';
import initConfigureStories from './stories/configure.stories';

export default () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@ import { storiesOf } from 'dev-novel';
import instantsearch from '../../../../index';
import { wrapWithHits } from '../../utils/wrap-with-hits.js';

const stories = storiesOf('Toggle');
const stories = storiesOf('ToggleRefinement');

export default () => {
stories
.add(
'default',
wrapWithHits(container => {
window.search.addWidget(
instantsearch.widgets.toggle({
instantsearch.widgets.toggleRefinement({
container,
attributeName: 'free_shipping',
label: 'Free Shipping (toggle single value)',
attribute: 'free_shipping',
templates: {
header: 'Shipping',
labelText: 'Free Shipping (toggle single value)',
},
})
);
Expand All @@ -27,16 +26,13 @@ export default () => {
'with on & off values',
wrapWithHits(container => {
window.search.addWidget(
instantsearch.widgets.toggle({
instantsearch.widgets.toggleRefinement({
container,
attributeName: 'brand',
label: 'Canon (not checked) or sony (checked)',
values: {
on: 'Sony',
off: 'Canon',
},
attribute: 'brand',
on: 'Sony',
off: 'Canon',
templates: {
header: 'Google or amazon (toggle two values)',
labelText: 'Canon (not checked) or sony (checked)',
},
})
);
Expand Down
2 changes: 1 addition & 1 deletion dev/app/jquery/init-stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import initSearchBoxStories from './stories/search-box.stories';
import initSortByStories from './stories/sort-by.stories';
import initStarRatingStories from './stories/star-rating.stories';
import initStatsStories from './stories/stats.stories';
import initToggleStories from './stories/toggle.stories';
import initToggleStories from './stories/toggleRefinement.stories';
import initAutcompleteStories from './stories/autocomplete.stories';

export default () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ import { storiesOf } from 'dev-novel';
import { wrapWithHitsAndJquery } from '../../utils/wrap-with-hits.js';
import * as widgets from '../widgets/index.js';

const stories = storiesOf('Toggle');
const stories = storiesOf('ToggleRefinement');

export default () => {
stories.add(
'default',
wrapWithHitsAndJquery(containerNode => {
window.search.addWidget(
widgets.toggle({
widgets.toggleRefinement({
containerNode,
attributeName: 'free_shipping',
label: 'Free Shipping (toggle single value)',
attribute: 'free_shipping',
title: 'Free Shipping',
})
);
Expand Down
2 changes: 1 addition & 1 deletion dev/app/jquery/widgets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export { default as searchBox } from './searchBox';
export { default as sortBy } from './sortBy';
export { default as starRating } from './starRating';
export { default as stats } from './stats';
export { default as toggle } from './toggle';
export { default as toggleRefinement } from './toggleRefinement';
export { default as infiniteHits } from './infiniteHits';
export { default as showMoreMenu } from './showMoreMenu';
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const renderFn = (
value,
createURL,
refine,
widgetParams: { title = 'Toggle', containerNode },
widgetParams: { title = 'ToggleRefinement', containerNode },
},
isFirstRendering
) => {
Expand Down Expand Up @@ -52,4 +52,4 @@ const renderFn = (
});
};

export default instantsearch.connectors.connectToggle(renderFn);
export default instantsearch.connectors.connectToggleRefinement(renderFn);
Loading

0 comments on commit d67a437

Please sign in to comment.