-
-
{btn}
+
+ {hitsList}
+
+ {loadMoreButton}
);
}
@@ -39,16 +84,16 @@ class InfiniteHits extends Component {
InfiniteHits.propTypes = {
cssClasses: PropTypes.shape({
root: PropTypes.string,
+ emptyRoot: PropTypes.string,
+ list: PropTypes.string,
item: PropTypes.string,
- allItems: PropTypes.string,
- empty: PropTypes.string,
- showmore: PropTypes.string,
- showmoreButton: PropTypes.string,
+ loadMore: PropTypes.string,
+ disabledLoadMore: PropTypes.string,
}),
hits: PropTypes.array,
results: PropTypes.object,
showMore: PropTypes.func,
- showMoreLabel: PropTypes.string,
+ loadMoreLabel: PropTypes.string,
templateProps: PropTypes.object.isRequired,
isLastPage: PropTypes.bool.isRequired,
};
diff --git a/src/components/__tests__/Hits-test.js b/src/components/__tests__/Hits-test.js
index 70f0bbcf7d..534624c587 100644
--- a/src/components/__tests__/Hits-test.js
+++ b/src/components/__tests__/Hits-test.js
@@ -1,4 +1,5 @@
import React from 'react';
+import renderer from 'react-test-renderer';
import { shallow } from 'enzyme';
import Hits from '../Hits';
import Template from '../Template';
@@ -37,8 +38,8 @@ describe('Hits', () => {
hits: [],
},
cssClasses: {
- root: 'my_root',
- empty: 'my_empty',
+ root: 'root',
+ emptyRoot: 'emptyRoot',
},
};
@@ -46,91 +47,7 @@ describe('Hits', () => {
const actual = shallowRender(props);
// Then
- expect(actual.props().rootProps.className).toContain('my_empty');
- expect(actual.props().rootProps.className).toContain('my_root');
- });
- });
-
- describe('allItems template', () => {
- it('should use the allItems template if defined', () => {
- // Given
- const props = {
- results: {
- hits: [
- {
- objectID: 'one',
- foo: 'bar',
- },
- ],
- },
- templateProps: {
- templates: {
- allItems: 'all items',
- },
- },
- };
-
- // When
- const actual = shallowRender(props);
-
- // Then
- expect(actual.props().templateKey).toEqual('allItems');
- });
-
- it('should set the allItems CSS class to the template', () => {
- // Given
- const props = {
- results: {
- hits: [
- {
- objectID: 'one',
- foo: 'bar',
- },
- ],
- },
- templateProps: {
- templates: {
- allItems: 'all items',
- },
- },
- cssClasses: {
- root: 'my_root',
- allItems: 'my_all_items',
- },
- };
-
- // When
- const actual = shallowRender(props);
-
- // Then
- expect(actual.props().rootProps.className).toContain('my_all_items');
- expect(actual.props().rootProps.className).toContain('my_root');
- });
-
- it('should pass the list of all results to the template', () => {
- // Given
- const results = {
- hits: [
- {
- objectID: 'one',
- foo: 'bar',
- },
- ],
- };
- const props = {
- results,
- templateProps: {
- templates: {
- allItems: 'all items',
- },
- },
- };
-
- // When
- const actual = shallowRender(props);
-
- // Then
- expect(actual.props().data).toEqual(results);
+ expect(actual.props().rootProps.className).toContain('root');
});
});
@@ -182,7 +99,7 @@ describe('Hits', () => {
},
},
cssClasses: {
- item: 'my_item',
+ item: 'item',
},
};
@@ -190,7 +107,7 @@ describe('Hits', () => {
const actual = shallowRender(props).find(Template);
// Then
- expect(actual.props().rootProps.className).toContain('my_item');
+ expect(actual.props().rootProps.className).toContain('item');
});
it('should wrap the items in a root div element', () => {
@@ -214,7 +131,7 @@ describe('Hits', () => {
},
},
cssClasses: {
- root: 'my_root',
+ root: 'root',
},
};
@@ -223,7 +140,7 @@ describe('Hits', () => {
// Then
expect(actual.name()).toEqual('div');
- expect(actual.props().className).toContain('my_root');
+ expect(actual.props().className).toContain('root');
});
it('should pass each result data to each item template', () => {
@@ -316,4 +233,37 @@ describe('Hits', () => {
expect(actual.at(1).key()).toEqual('BAZ');
});
});
+
+ describe('markup', () => {
+ it('should render
', () => {
+ const hits = [
+ {
+ objectID: 'one',
+ foo: 'bar',
+ },
+ {
+ objectID: 'two',
+ foo: 'baz',
+ },
+ ];
+
+ const props = {
+ results: { hits },
+ hits,
+ cssClasses: {
+ root: 'root',
+ list: 'list',
+ item: 'item',
+ },
+ templateProps: {
+ templates: {
+ item: 'item',
+ },
+ },
+ };
+ const tree = renderer.create(
).toJSON();
+
+ expect(tree).toMatchSnapshot();
+ });
+ });
});
diff --git a/src/components/__tests__/InfiniteHits-test.js b/src/components/__tests__/InfiniteHits-test.js
new file mode 100644
index 0000000000..d836d0e783
--- /dev/null
+++ b/src/components/__tests__/InfiniteHits-test.js
@@ -0,0 +1,129 @@
+import React from 'react';
+import renderer from 'react-test-renderer';
+import InfiniteHits from '../InfiniteHits';
+
+describe('InfiniteHits', () => {
+ describe('markup', () => {
+ it('should render
on first page', () => {
+ const hits = [
+ {
+ objectID: 'one',
+ foo: 'bar',
+ },
+ {
+ objectID: 'two',
+ foo: 'baz',
+ },
+ ];
+
+ const props = {
+ results: { hits },
+ hits,
+ isLastPage: false,
+ cssClasses: {
+ root: 'root',
+ emptyRoot: 'emptyRoot',
+ list: 'list',
+ item: 'item',
+ loadMore: 'loadMore',
+ disabledLoadMore: 'disabledLoadMore',
+ },
+ templateProps: {
+ templates: {
+ item: 'item',
+ },
+ },
+ };
+ const tree = renderer.create(
).toJSON();
+
+ expect(tree).toMatchSnapshot();
+ });
+
+ it('should render
on last page', () => {
+ const hits = [
+ {
+ objectID: 'one',
+ foo: 'bar',
+ },
+ {
+ objectID: 'two',
+ foo: 'baz',
+ },
+ ];
+
+ const props = {
+ results: { hits },
+ hits,
+ isLastPage: true,
+ cssClasses: {
+ root: 'root',
+ emptyRoot: 'emptyRoot',
+ list: 'list',
+ item: 'item',
+ loadMore: 'loadMore',
+ disabledLoadMore: 'disabledLoadMore',
+ },
+ templateProps: {
+ templates: {
+ item: 'item',
+ },
+ },
+ };
+ const tree = renderer.create(
).toJSON();
+
+ expect(tree).toMatchSnapshot();
+ });
+
+ it('should render
without hits on first page', () => {
+ const hits = [];
+
+ const props = {
+ results: { hits },
+ hits,
+ isLastPage: false,
+ cssClasses: {
+ root: 'root',
+ emptyRoot: 'emptyRoot',
+ list: 'list',
+ item: 'item',
+ loadMore: 'loadMore',
+ disabledLoadMore: 'disabledLoadMore',
+ },
+ templateProps: {
+ templates: {
+ empty: 'empty',
+ },
+ },
+ };
+ const tree = renderer.create(
).toJSON();
+
+ expect(tree).toMatchSnapshot();
+ });
+
+ it('should render
without hits on last page', () => {
+ const hits = [];
+
+ const props = {
+ results: { hits },
+ hits,
+ isLastPage: true,
+ cssClasses: {
+ root: 'root',
+ emptyRoot: 'emptyRoot',
+ list: 'list',
+ item: 'item',
+ loadMore: 'loadMore',
+ disabledLoadMore: 'disabledLoadMore',
+ },
+ templateProps: {
+ templates: {
+ empty: 'empty',
+ },
+ },
+ };
+ const tree = renderer.create(
).toJSON();
+
+ expect(tree).toMatchSnapshot();
+ });
+ });
+});
diff --git a/src/components/__tests__/__snapshots__/Hits-test.js.snap b/src/components/__tests__/__snapshots__/Hits-test.js.snap
new file mode 100644
index 0000000000..333bbd03a2
--- /dev/null
+++ b/src/components/__tests__/__snapshots__/Hits-test.js.snap
@@ -0,0 +1,28 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Hits markup should render
1`] = `
+
+`;
diff --git a/src/components/__tests__/__snapshots__/InfiniteHits-test.js.snap b/src/components/__tests__/__snapshots__/InfiniteHits-test.js.snap
new file mode 100644
index 0000000000..cdd868b573
--- /dev/null
+++ b/src/components/__tests__/__snapshots__/InfiniteHits-test.js.snap
@@ -0,0 +1,84 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`InfiniteHits markup should render
on first page 1`] = `
+
+`;
+
+exports[`InfiniteHits markup should render
on last page 1`] = `
+
+`;
+
+exports[`InfiniteHits markup should render
without hits on first page 1`] = `
+
+`;
+
+exports[`InfiniteHits markup should render
without hits on last page 1`] = `
+
+`;
diff --git a/src/connectors/hits/__tests__/connectHits-test.js b/src/connectors/hits/__tests__/connectHits-test.js
index 23f9f588cb..e13ad88bdd 100644
--- a/src/connectors/hits/__tests__/connectHits-test.js
+++ b/src/connectors/hits/__tests__/connectHits-test.js
@@ -9,7 +9,7 @@ describe('connectHits', () => {
// flag set accordingly
const rendering = jest.fn();
const makeWidget = connectHits(rendering);
- const widget = makeWidget({ escapeHits: true });
+ const widget = makeWidget({ escapeHTML: true });
expect(widget.getConfiguration()).toEqual({
highlightPreTag: '__ais-highlight__',
@@ -32,7 +32,7 @@ describe('connectHits', () => {
expect(rendering).toHaveBeenCalledTimes(1);
// test that rendering has been called during init with isFirstRendering = true
expect(rendering).toHaveBeenLastCalledWith(
- expect.objectContaining({ widgetParams: { escapeHits: true } }),
+ expect.objectContaining({ widgetParams: { escapeHTML: true } }),
true
);
@@ -46,7 +46,7 @@ describe('connectHits', () => {
expect(rendering).toHaveBeenCalledTimes(2);
// test that rendering has been called during init with isFirstRendering = false
expect(rendering).toHaveBeenLastCalledWith(
- expect.objectContaining({ widgetParams: { escapeHits: true } }),
+ expect.objectContaining({ widgetParams: { escapeHTML: true } }),
false
);
});
@@ -98,7 +98,7 @@ describe('connectHits', () => {
it('escape highlight properties if requested', () => {
const rendering = jest.fn();
const makeWidget = connectHits(rendering);
- const widget = makeWidget({ escapeHits: true });
+ const widget = makeWidget({ escapeHTML: true });
const helper = jsHelper({}, '', {});
helper.search = jest.fn();
diff --git a/src/connectors/hits/connectHits.js b/src/connectors/hits/connectHits.js
index f81f08b0ab..e5920c3360 100644
--- a/src/connectors/hits/connectHits.js
+++ b/src/connectors/hits/connectHits.js
@@ -1,4 +1,4 @@
-import escapeHits, { tagConfig } from '../../lib/escape-highlight.js';
+import escapeHTML, { tagConfig } from '../../lib/escape-highlight.js';
import { checkRendering } from '../../lib/utils.js';
const usage = `Usage:
@@ -12,7 +12,7 @@ var customHits = connectHits(function render(params, isFirstRendering) {
});
search.addWidget(
customHits({
- [ escapeHits = false ],
+ [ escapeHTML = true ],
[ transformItems ]
})
);
@@ -28,7 +28,7 @@ Full documentation available at https://community.algolia.com/instantsearch.js/v
/**
* @typedef {Object} CustomHitsWidgetOptions
- * @property {boolean} [escapeHits = false] If true, escape HTML tags from `hits[i]._highlightResult`.
+ * @property {boolean} [escapeHTML = true] Whether to escape HTML tags from `hits[i]._highlightResult`.
* @property {function(object[]):object[]} [transformItems] Function to transform the items passed to the templates.
*/
@@ -66,7 +66,7 @@ export default function connectHits(renderFn, unmountFn) {
return {
getConfiguration() {
- return widgetParams.escapeHits ? tagConfig : undefined;
+ return widgetParams.escapeHTML ? tagConfig : undefined;
},
init({ instantSearchInstance }) {
@@ -85,11 +85,11 @@ export default function connectHits(renderFn, unmountFn) {
results.hits = transformItems(results.hits);
if (
- widgetParams.escapeHits &&
+ widgetParams.escapeHTML &&
results.hits &&
results.hits.length > 0
) {
- results.hits = escapeHits(results.hits);
+ results.hits = escapeHTML(results.hits);
}
renderFn(
diff --git a/src/connectors/infinite-hits/__tests__/connectInfiniteHits-test.js b/src/connectors/infinite-hits/__tests__/connectInfiniteHits-test.js
index 3c88cd8512..e16dfc4ff9 100644
--- a/src/connectors/infinite-hits/__tests__/connectInfiniteHits-test.js
+++ b/src/connectors/infinite-hits/__tests__/connectInfiniteHits-test.js
@@ -10,7 +10,7 @@ describe('connectInfiniteHits', () => {
const rendering = jest.fn();
const makeWidget = connectInfiniteHits(rendering);
const widget = makeWidget({
- escapeHits: true,
+ escapeHTML: true,
});
expect(widget.getConfiguration()).toEqual({
@@ -42,7 +42,7 @@ describe('connectInfiniteHits', () => {
isLastPage: true,
instantSearchInstance: undefined,
widgetParams: {
- escapeHits: true,
+ escapeHTML: true,
},
}),
true
@@ -68,7 +68,7 @@ describe('connectInfiniteHits', () => {
isLastPage: false,
instantSearchInstance: undefined,
widgetParams: {
- escapeHits: true,
+ escapeHTML: true,
},
}),
false
@@ -153,7 +153,7 @@ describe('connectInfiniteHits', () => {
it('escape highlight properties if requested', () => {
const rendering = jest.fn();
const makeWidget = connectInfiniteHits(rendering);
- const widget = makeWidget({ escapeHits: true });
+ const widget = makeWidget({ escapeHTML: true });
const helper = jsHelper({}, '', {});
helper.search = jest.fn();
diff --git a/src/connectors/infinite-hits/connectInfiniteHits.js b/src/connectors/infinite-hits/connectInfiniteHits.js
index 1bf7a08e3e..b7376cf76e 100644
--- a/src/connectors/infinite-hits/connectInfiniteHits.js
+++ b/src/connectors/infinite-hits/connectInfiniteHits.js
@@ -1,4 +1,4 @@
-import escapeHits, { tagConfig } from '../../lib/escape-highlight.js';
+import escapeHTML, { tagConfig } from '../../lib/escape-highlight.js';
import { checkRendering } from '../../lib/utils.js';
const usage = `Usage:
@@ -14,7 +14,7 @@ var customInfiniteHits = connectInfiniteHits(function render(params, isFirstRend
});
search.addWidget(
customInfiniteHits({
- [ escapeHits: true ],
+ [ escapeHTML = true ],
[ transformItems ]
})
);
@@ -32,7 +32,7 @@ Full documentation available at https://community.algolia.com/instantsearch.js/v
/**
* @typedef {Object} CustomInfiniteHitsWidgetOptions
- * @property {boolean} [escapeHits = false] If true, escape HTML tags from `hits[i]._highlightResult`.
+ * @property {boolean} [escapeHTML = true] Whether to escape HTML tags from `hits[i]._highlightResult`.
* @property {function(object[]):object[]} [transformItems] Function to transform the items passed to the templates.
*/
@@ -88,7 +88,7 @@ export default function connectInfiniteHits(renderFn, unmountFn) {
return {
getConfiguration() {
- return widgetParams.escapeHits ? tagConfig : undefined;
+ return widgetParams.escapeHTML ? tagConfig : undefined;
},
init({ instantSearchInstance, helper }) {
@@ -116,11 +116,11 @@ export default function connectInfiniteHits(renderFn, unmountFn) {
results.hits = transformItems(results.hits);
if (
- widgetParams.escapeHits &&
+ widgetParams.escapeHTML &&
results.hits &&
results.hits.length > 0
) {
- results.hits = escapeHits(results.hits);
+ results.hits = escapeHTML(results.hits);
}
if (lastReceivedPage < state.page) {
diff --git a/src/widgets/hits/__tests__/__snapshots__/hits-test.js.snap b/src/widgets/hits/__tests__/__snapshots__/hits-test.js.snap
index 36929b4314..56328e42c9 100644
--- a/src/widgets/hits/__tests__/__snapshots__/hits-test.js.snap
+++ b/src/widgets/hits/__tests__/__snapshots__/hits-test.js.snap
@@ -4,9 +4,10 @@ exports[`hits() calls twice ReactDOM.render(
, container) 1`] = `
, container) 2`] = `
Hit {{objectID}}: {{{_highlightResult.name.value}}}'
* },
- * escapeHits: true,
* transformItems: items => items.map(item => item),
* })
* );
@@ -113,7 +107,7 @@ export default function hits({
cssClasses: userCssClasses = {},
templates = defaultTemplates,
transformData,
- escapeHits = false,
+ escapeHTML = true,
transformItems,
}) {
if (!container) {
@@ -126,9 +120,10 @@ export default function hits({
const containerNode = getContainerNode(container);
const cssClasses = {
- root: cx(bem(null), userCssClasses.root),
- item: cx(bem('item'), userCssClasses.item),
- empty: cx(bem(null, 'empty'), userCssClasses.empty),
+ root: cx(suit(), userCssClasses.root),
+ emptyRoot: cx(suit({ modifierName: 'empty' }), userCssClasses.emptyRoot),
+ list: cx(suit({ descendantName: 'list' }), userCssClasses.list),
+ item: cx(suit({ descendantName: 'item' }), userCssClasses.item),
};
const specializedRenderer = renderer({
@@ -143,7 +138,7 @@ export default function hits({
const makeHits = connectHits(specializedRenderer, () =>
unmountComponentAtNode(containerNode)
);
- return makeHits({ escapeHits, transformItems });
+ return makeHits({ escapeHTML, transformItems });
} catch (e) {
throw new Error(usage);
}
diff --git a/src/widgets/infinite-hits/__tests__/__snapshots__/infinite-hits-test.js.snap b/src/widgets/infinite-hits/__tests__/__snapshots__/infinite-hits-test.js.snap
index 9d3fb13117..55dfc153d4 100644
--- a/src/widgets/infinite-hits/__tests__/__snapshots__/infinite-hits-test.js.snap
+++ b/src/widgets/infinite-hits/__tests__/__snapshots__/infinite-hits-test.js.snap
@@ -4,11 +4,12 @@ exports[`infiniteHits() calls twice ReactDOM.render(, container) 1
, container) 1
]
}
isLastPage={false}
+ loadMoreLabel="Show more results"
results={
Object {
"hits": Array [
@@ -31,7 +33,6 @@ exports[`infiniteHits() calls twice ReactDOM.render(, container) 1
}
}
showMore={[Function]}
- showMoreLabel="Show more results"
templateProps={
Object {
"templates": Object {
@@ -53,11 +54,12 @@ exports[`infiniteHits() calls twice ReactDOM.render(, container) 2
, container) 2
]
}
isLastPage={false}
+ loadMoreLabel="Show more results"
results={
Object {
"hits": Array [
@@ -80,7 +83,6 @@ exports[`infiniteHits() calls twice ReactDOM.render(, container) 2
}
}
showMore={[Function]}
- showMoreLabel="Show more results"
templateProps={
Object {
"templates": Object {
@@ -102,11 +104,12 @@ exports[`infiniteHits() if it is the last page, then the props should contain is
{
container = document.createElement('div');
widget = infiniteHits({
container,
- escapeHits: true,
+ escapeHTML: true,
cssClasses: { root: ['root', 'cx'] },
});
widget.init({ helper, instantSearchInstance: {} });
diff --git a/src/widgets/infinite-hits/infinite-hits.js b/src/widgets/infinite-hits/infinite-hits.js
index 01fe1dd2c7..44e83c79dd 100644
--- a/src/widgets/infinite-hits/infinite-hits.js
+++ b/src/widgets/infinite-hits/infinite-hits.js
@@ -4,14 +4,10 @@ import cx from 'classnames';
import InfiniteHits from '../../components/InfiniteHits.js';
import defaultTemplates from './defaultTemplates.js';
import connectInfiniteHits from '../../connectors/infinite-hits/connectInfiniteHits.js';
+import { prepareTemplateProps, getContainerNode } from '../../lib/utils.js';
+import { component } from '../../lib/suit';
-import {
- bemHelper,
- prepareTemplateProps,
- getContainerNode,
-} from '../../lib/utils.js';
-
-const bem = bemHelper('ais-infinite-hits');
+const suit = component('InfiniteHits');
const renderer = ({
cssClasses,
@@ -19,7 +15,7 @@ const renderer = ({
renderState,
templates,
transformData,
- showMoreLabel,
+ loadMoreLabel,
}) => (
{ hits, results, showMore, isLastPage, instantSearchInstance },
isFirstRendering
@@ -40,7 +36,7 @@ const renderer = ({
hits={hits}
results={results}
showMore={showMore}
- showMoreLabel={showMoreLabel}
+ loadMoreLabel={loadMoreLabel}
templateProps={renderState.templateProps}
isLastPage={isLastPage}
/>,
@@ -52,10 +48,10 @@ const usage = `
Usage:
infiniteHits({
container,
- [ escapeHits = false ],
+ [ escapeHTML = true ],
[ transformItems ],
- [ showMoreLabel ],
- [ cssClasses.{root,empty,item,showmore,showmoreButton}={} ],
+ [ loadMoreLabel = "Show more results" ],
+ [ cssClasses.{root,emptyRoot,list,item,loadMore,disabledLoadMore}={} ],
[ templates.{empty,item} | templates.{empty} ],
[ transformData.{empty,item} | transformData.{empty} ],
})`;
@@ -75,20 +71,21 @@ infiniteHits({
/**
* @typedef {object} InfiniteHitsCSSClasses
* @property {string|string[]} [root] CSS class to add to the wrapping element.
- * @property {string|string[]} [empty] CSS class to add to the wrapping element when no results.
+ * @property {string|string[]} [emptyRoot] CSS class to add to the wrapping element when no results.
+ * @property {string|string[]} [list] CSS class to add to the list of results.
* @property {string|string[]} [item] CSS class to add to each result.
- * @property {string|string[]} [showmore] CSS class to add to the show more button container.
- * @property {string|string[]} [showmoreButton] CSS class to add to the show more button.
+ * @property {string|string[]} [loadMore] CSS class to add to the load more button.
+ * @property {string|string[]} [disabledLoadMore] CSS class to add to the load more button when disabled.
*/
/**
* @typedef {Object} InfiniteHitsWidgetOptions
* @property {string|HTMLElement} container CSS Selector or HTMLElement to insert the widget.
* @property {InfiniteHitsTemplates} [templates] Templates to use for the widget.
- * @property {string} [showMoreLabel="Show more results"] label used on the show more button.
+ * @property {string} [loadMoreLabel="Show more results"] label used on the load more button.
* @property {InfiniteHitsTransforms} [transformData] Method to change the object passed to the templates.
* @property {InfiniteHitsCSSClasses} [cssClasses] CSS classes to add.
- * @property {boolean} [escapeHits = false] Escape HTML entities from hits string values.
+ * @property {boolean} [escapeHTML = true] Escape HTML entities from hits string values.
* @property {function(object[]):object[]} [transformItems] Function to transform the items passed to the templates.
*/
@@ -111,7 +108,6 @@ infiniteHits({
* empty: 'No results',
* item: 'Hit {{objectID}}: {{{_highlightResult.name.value}}}'
* },
- * escapeHits: true,
* transformItems: items => items.map(item => item),
* })
* );
@@ -119,10 +115,10 @@ infiniteHits({
export default function infiniteHits({
container,
cssClasses: userCssClasses = {},
- showMoreLabel = 'Show more results',
+ loadMoreLabel = 'Show more results',
templates = defaultTemplates,
transformData,
- escapeHits = false,
+ escapeHTML = true,
transformItems,
} = {}) {
if (!container) {
@@ -139,11 +135,15 @@ export default function infiniteHits({
const containerNode = getContainerNode(container);
const cssClasses = {
- root: cx(bem(null), userCssClasses.root),
- item: cx(bem('item'), userCssClasses.item),
- empty: cx(bem(null, 'empty'), userCssClasses.empty),
- showmore: cx(bem('showmore'), userCssClasses.showmore),
- showmoreButton: cx(bem('showmoreButton'), userCssClasses.showmoreButton),
+ root: cx(suit(), userCssClasses.root),
+ emptyRoot: cx(suit({ modifierName: 'empty' }), userCssClasses.emptyRoot),
+ item: cx(suit({ descendantName: 'item' }), userCssClasses.item),
+ list: cx(suit({ descendantName: 'list' }), userCssClasses.list),
+ loadMore: cx(suit({ descendantName: 'loadMore' }), userCssClasses.loadMore),
+ loadMoreDisabled: cx(
+ suit({ descendantName: 'loadMore', modifierName: 'disabled' }),
+ userCssClasses.loadMoreDisabled
+ ),
};
const specializedRenderer = renderer({
@@ -151,7 +151,7 @@ export default function infiniteHits({
cssClasses,
transformData,
templates,
- showMoreLabel,
+ loadMoreLabel,
renderState: {},
});
@@ -159,7 +159,7 @@ export default function infiniteHits({
const makeInfiniteHits = connectInfiniteHits(specializedRenderer, () =>
unmountComponentAtNode(containerNode)
);
- return makeInfiniteHits({ escapeHits, transformItems });
+ return makeInfiniteHits({ escapeHTML, transformItems });
} catch (e) {
throw new Error(usage);
}