Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stereobooster committed Nov 22, 2023
1 parent 5b229cc commit 9a323df
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/demo/src/widgets/Products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ export const products = hits({
item: (hit, { html, components }) => html`
<article class="hit">
<header class="hit-image-container">
<img src="${hit.image}" alt="${hit.name}" class="hit-image" loading="lazy" />
<img
src="${hit.image}"
alt="${hit.name}"
class="hit-image"
loading="lazy"
/>
</header>
<div class="hit-info-container">
Expand Down Expand Up @@ -49,7 +54,12 @@ export const products = hits({
</article>
`,
empty: (searchResults, { html }) => {
const query = searchResults._state.query;
const hasRefinements = searchResults.getRefinements().length > 0;
const message =
query == ""
? "Type any query in order to start"
: "Sorry, we can't find any matches to your query!";
const description = hasRefinements
? "Try to reset your applied filters."
: "Please try another query.";
Expand Down Expand Up @@ -132,10 +142,10 @@ export const products = hits({
</g>
</svg>
<p class="hits-empty-state-title">
Sorry, we can't find any matches to your query!
<p class="hits-empty-state-title">${message}</p>
<p class="hits-empty-state-description">
${query != "" ? description : ""}
</p>
<p class="hits-empty-state-description">${description}</p>
</div>
`;
},
Expand Down

0 comments on commit 9a323df

Please sign in to comment.