aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/layout/no-results.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-05-24 16:44:29 +0200
committerArmand Philippot <git@armandphilippot.com>2022-05-24 16:44:29 +0200
commit1e982fb02a9967e0efdc76c93a44798a9f2dcb43 (patch)
treeb9a526ade81feee20cf18404e2a7053ccff6c999 /src/components/organisms/layout/no-results.tsx
parentc347190a4307c172d15dac156da86567098035f6 (diff)
chore: add a search form when posts list prints no results
Diffstat (limited to 'src/components/organisms/layout/no-results.tsx')
-rw-r--r--src/components/organisms/layout/no-results.tsx38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/components/organisms/layout/no-results.tsx b/src/components/organisms/layout/no-results.tsx
new file mode 100644
index 0000000..2245dbf
--- /dev/null
+++ b/src/components/organisms/layout/no-results.tsx
@@ -0,0 +1,38 @@
+import SearchForm, {
+ type SearchFormProps,
+} from '@components/organisms/forms/search-form';
+import { FC } from 'react';
+import { useIntl } from 'react-intl';
+
+export type NoResultsProps = Pick<SearchFormProps, 'searchPage'>;
+
+/**
+ * NoResults component
+ *
+ * Renders a no results text with a search form.
+ */
+const NoResults: FC<NoResultsProps> = ({ searchPage }) => {
+ const intl = useIntl();
+
+ return (
+ <>
+ <p>
+ {intl.formatMessage({
+ defaultMessage: 'No results found.',
+ description: 'NoResults: no results',
+ id: '5O2vpy',
+ })}
+ </p>
+ <p>
+ {intl.formatMessage({
+ defaultMessage: 'Would you like to try a new search?',
+ description: 'NoResults: try a new search message',
+ id: 'DVBwfu',
+ })}
+ </p>
+ <SearchForm hideLabel={true} searchPage={searchPage} />
+ </>
+ );
+};
+
+export default NoResults;