@usereactify/search 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,9 +11,10 @@ declare type ResultProps = ReactivesearchResultProps & {
|
|
|
11
11
|
products: ElasticProduct[];
|
|
12
12
|
};
|
|
13
13
|
declare type Props = {
|
|
14
|
-
gridGap?: number;
|
|
15
14
|
pageSize?: number;
|
|
15
|
+
gridGap?: number;
|
|
16
16
|
gridColumns?: number;
|
|
17
|
+
gridStyle?: React.HTMLAttributes<HTMLElement>["style"];
|
|
17
18
|
listClassName?: string;
|
|
18
19
|
renderLoading?: () => JSX.Element | null;
|
|
19
20
|
renderNoResults?: () => JSX.Element | null;
|
|
@@ -23,17 +23,17 @@ const ResultList = (props) => {
|
|
|
23
23
|
};
|
|
24
24
|
exports.ResultList = ResultList;
|
|
25
25
|
const ResultListInner = (props) => {
|
|
26
|
-
const { gridGap, gridColumns, renderError, renderAfter, renderBefore, renderLoading, listClassName, renderResults, renderNoResults, renderResultCard, renderLoadMoreButton, renderResultCardCallout, reactivesearchResultProps, } = props;
|
|
26
|
+
const { gridGap, gridColumns, gridStyle, renderError, renderAfter, renderBefore, renderLoading, listClassName, renderResults, renderNoResults, renderResultCard, renderLoadMoreButton, renderResultCardCallout, reactivesearchResultProps, } = props;
|
|
27
27
|
const filterStack = (0, hooks_1.useFilterStack)();
|
|
28
28
|
const { instantSearch, searchQuery } = (0, hooks_1.useSearch)();
|
|
29
29
|
const { track } = (0, __1.useAnalytics)();
|
|
30
30
|
const initialSearchHasRun = react_1.default.useMemo(() => "undefined" !==
|
|
31
31
|
typeof reactivesearchResultProps.resultStats.numberOfResults, [reactivesearchResultProps]);
|
|
32
|
-
const styleProp = react_1.default.useMemo(() =>
|
|
32
|
+
const styleProp = react_1.default.useMemo(() => gridStyle !== null && gridStyle !== void 0 ? gridStyle : {
|
|
33
33
|
display: "grid",
|
|
34
34
|
gap: `${gridGap !== null && gridGap !== void 0 ? gridGap : "0px"}`,
|
|
35
35
|
gridTemplateColumns: `repeat(${gridColumns !== null && gridColumns !== void 0 ? gridColumns : 4}, minmax(0, 1fr))`,
|
|
36
|
-
}
|
|
36
|
+
}, [gridGap, gridColumns, gridStyle]);
|
|
37
37
|
const resultProps = react_1.default.useMemo(() => (Object.assign(Object.assign({}, reactivesearchResultProps), { products: reactivesearchResultProps.data.filter((document) => elastic_1.ElasticDocumentType.Product === document.type || !document.type), callouts: reactivesearchResultProps.data.filter((document) => elastic_1.ElasticDocumentType.Callout === document.type) })), [reactivesearchResultProps]);
|
|
38
38
|
if (reactivesearchResultProps.error) {
|
|
39
39
|
if (renderError)
|