-);
+ );
}
export default HitTest;
\ No newline at end of file
diff --git a/src/components/Search/NoResults.tsx b/src/components/Search/NoResults.tsx
index c553b2a..04a2d8e 100644
--- a/src/components/Search/NoResults.tsx
+++ b/src/components/Search/NoResults.tsx
@@ -1,100 +1,100 @@
-import React from "react";
-import { useInstantSearch } from "react-instantsearch";
+import React from 'react';
+import { useInstantSearch } from 'react-instantsearch';
-import { ClearFilters } from "./ClearFilters";
+import { ClearFilters } from './ClearFilters';
export function NoResults() {
- const { results } = useInstantSearch();
+ const { results } = useInstantSearch();
- const hasRefinements = results.getRefinements().length > 0;
- const description = hasRefinements
- ? "Try to reset your applied filters."
- : "Please try another query.";
+ const hasRefinements = results.getRefinements().length > 0;
+ const description = hasRefinements
+ ? 'Try to reset your applied filters.'
+ : 'Please try another query.';
- return (
-
-
+ return (
+
+
-
- Sorry, we can't find any matches to your query!
-
-
{description}
+
+ Sorry, we can't find any matches to your query!
+
+
{description}
-
-
- );
-}
+
+
+ );
+}
\ No newline at end of file
diff --git a/src/components/Search/NoResultsBoundary.tsx b/src/components/Search/NoResultsBoundary.tsx
new file mode 100644
index 0000000..4335d6e
--- /dev/null
+++ b/src/components/Search/NoResultsBoundary.tsx
@@ -0,0 +1,25 @@
+import React from 'react';
+import { useInstantSearch } from 'react-instantsearch';
+
+export function NoResultsBoundary({
+ children,
+ fallback,
+ }: {
+ children: React.ReactNode;
+ fallback: React.ReactNode;
+}) {
+ const { results } = useInstantSearch();
+
+ // The `__isArtificial` flag makes sure to not display the No Results message
+ // when no hits have been returned yet.
+ if (!results.__isArtificial && results.nbHits === 0) {
+ return (
+ <>
+ {fallback}
+
{children}
+ >
+ );
+ }
+
+ return <>{children}>;
+}
\ No newline at end of file
diff --git a/src/components/Search/ResultsNumberMobile.tsx b/src/components/Search/ResultsNumberMobile.tsx
index 361b438..1c51d07 100644
--- a/src/components/Search/ResultsNumberMobile.tsx
+++ b/src/components/Search/ResultsNumberMobile.tsx
@@ -1,5 +1,7 @@
-import React from "react";
-import { useInstantSearch } from "react-instantsearch";
+import React from 'react';
+import { useInstantSearch } from 'react-instantsearch';
+
+import { formatNumber } from '../../utils';
export function ResultsNumberMobile() {
const {
@@ -8,7 +10,7 @@ export function ResultsNumberMobile() {
return (