From 56878f647ea0f1066fa3e222d7aa0d83057f496d Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Mon, 13 Nov 2023 17:45:59 +0100
Subject: refactor(components): rewrite PostsList component

* remove NoResults component and move logic to Search page
* add a usePostsList hook
* remove Pagination from PostsList (it is only used if javascript is
disabled and not on every posts list)
* replace `byYear` prop with `sortByYear`
* replace `loadMore` prop with `onLoadMore`
* remove `showLoadMoreBtn` (we can use `loadMore` prop instead to
determine if we need to display the button)
* replace `titleLevel` prop with `headingLvl`
* add `firstNewResult` prop to handle focus on the new results when
loading more article (we should not focus a useless span but the item
directly)
---
 .../organisms/layout/posts-list.fixture.tsx        | 62 ----------------------
 1 file changed, 62 deletions(-)
 delete mode 100644 src/components/organisms/layout/posts-list.fixture.tsx

(limited to 'src/components/organisms/layout/posts-list.fixture.tsx')

diff --git a/src/components/organisms/layout/posts-list.fixture.tsx b/src/components/organisms/layout/posts-list.fixture.tsx
deleted file mode 100644
index e1f7a95..0000000
--- a/src/components/organisms/layout/posts-list.fixture.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-import NextImage from 'next/image';
-import type { PostData } from './posts-list';
-
-export const introPost1 =
-  'Esse et voluptas sapiente modi impedit unde et. Ducimus nulla ea impedit sit placeat nihil assumenda. Rem est fugiat amet quo hic. Corrupti fuga quod animi autem dolorem ullam corrupti vel aut.';
-
-export const introPost2 =
-  'Illum quae asperiores quod aut necessitatibus itaque excepturi voluptas. Incidunt exercitationem ullam saepe alias consequatur sed. Quam veniam quaerat voluptatum earum quia quisquam fugiat sed perspiciatis. Et velit saepe est recusandae facilis eos eum ipsum.';
-
-export const introPost3 =
-  'Sunt aperiam ut rem impedit dolor id sit. Reprehenderit ipsum iusto fugiat. Quaerat laboriosam magnam facilis. Totam sint aliquam voluptatem in quis laborum sunt eum. Enim aut debitis officiis porro iure quia nihil voluptas ipsum. Praesentium quis necessitatibus cumque quia qui velit quos dolorem.';
-
-export const cover = {
-  alt: 'cover',
-  height: 480,
-  src: 'http://picsum.photos/640/480',
-  width: 640,
-};
-
-export const posts: PostData[] = [
-  {
-    cover: <NextImage {...cover} />,
-    excerpt: introPost1,
-    id: 'post-1',
-    meta: {
-      publicationDate: '2022-02-26',
-      wordsCount: introPost1.split(' ').length,
-      thematics: [
-        { id: 1, name: 'Cat 1', url: '#' },
-        { id: 2, name: 'Cat 2', url: '#' },
-      ],
-      comments: { count: 1, postHeading: 'Ratione velit fuga' },
-    },
-    heading: 'Ratione velit fuga',
-    url: '#',
-  },
-  {
-    excerpt: introPost2,
-    id: 'post-2',
-    meta: {
-      publicationDate: '2022-02-20',
-      wordsCount: introPost2.split(' ').length,
-      thematics: [{ id: 2, name: 'Cat 2', url: '#' }],
-      comments: { count: 0, postHeading: 'Debitis laudantium laudantium' },
-    },
-    heading: 'Debitis laudantium laudantium',
-    url: '#',
-  },
-  {
-    cover: <NextImage {...cover} />,
-    excerpt: introPost3,
-    id: 'post-3',
-    meta: {
-      publicationDate: '2021-12-20',
-      wordsCount: introPost3.split(' ').length,
-      thematics: [{ id: 1, name: 'Cat 1', url: '#' }],
-      comments: { count: 3, postHeading: 'Quaerat ut corporis' },
-    },
-    heading: 'Quaerat ut corporis',
-    url: '#',
-  },
-];
-- 
cgit v1.2.3

