@findify/react-components
Version:
Findify react UI components
76 lines (74 loc) • 2.89 kB
JavaScript
/**
* @module layouts/ZeroResults
*/
import { useItems } from '@findify/react-connect';
import ProductCard from "../../components/Cards/Product";
import Text from "../../components/Text";
import Grid from "../../components/common/Grid";
import MapArray from "../../components/common/MapArray";
import { hideLoader } from "../../helpers/loader";
import useTranslations from "../../helpers/useTranslations";
var styles = {
"container": "findify-layouts--zero-results__container",
"wrapper": "findify-layouts--zero-results__wrapper",
"sorry-container": "findify-layouts--zero-results__sorry-container",
"sorry": "findify-layouts--zero-results__sorry",
"suggestions-container": "findify-layouts--zero-results__suggestions-container",
"possible-suggestions": "findify-layouts--zero-results__possible-suggestions",
"recommendation": "findify-layouts--zero-results__recommendation",
"recommendation-container": "findify-layouts--zero-results__recommendation-container",
"sorryContainer": "findify-layouts--zero-results__sorry-container",
"suggestionsContainer": "findify-layouts--zero-results__suggestions-container",
"possibleSuggestions": "findify-layouts--zero-results__possible-suggestions",
"recommendationContainer": "findify-layouts--zero-results__recommendation-container"
};
import { useEffect } from 'react';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
export default (function (_ref) {
var q = _ref.q,
_ref$theme = _ref.theme,
theme = _ref$theme === void 0 ? styles : _ref$theme;
var _useItems = useItems(),
items = _useItems.items,
config = _useItems.config;
var translate = useTranslations();
useEffect(function () {
return hideLoader();
}, []);
return /*#__PURE__*/_jsxs("div", {
className: theme.container,
children: [/*#__PURE__*/_jsxs("div", {
className: theme.wrapper,
children: [/*#__PURE__*/_jsx("div", {
className: theme.sorryContainer,
children: /*#__PURE__*/_jsx(Text, {
style: {
marginTop: 20
},
primary: true,
html: translate(q ? 'zeroresults.noResultsFound' : 'zeroresults.noResultEmptyQuery', escape(q))
})
}), /*#__PURE__*/_jsx("div", {
className: theme.recommendationContainer,
children: /*#__PURE__*/_jsx(Text, {
className: theme.recommendation,
primary: true,
inlineBlock: true,
children: translate('zeroresults.checkOutPopularProducts')
})
})]
}), /*#__PURE__*/_jsx(Grid, {
role: "main",
wrapperComponent: "ul",
columnComponent: "li",
gutter: 12,
columns: config.getIn(['breakpoints', 'grid']),
children: MapArray({
array: items,
factory: ProductCard,
config: config.get('product')
})
})]
});
});