From 71942c86311a9d1ddf4ae486d811f8393786e855 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Tue, 25 Jan 2022 11:47:59 +0100
Subject: chore: display a progress bar before load more button

Since I'm using cursor pagination, users cannot know if there is a lot
of posts available. With this cursor, they can verify the progression.
---
 .../PaginationCursor/PaginationCursor.tsx          | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 src/components/PaginationCursor/PaginationCursor.tsx

(limited to 'src/components/PaginationCursor/PaginationCursor.tsx')

diff --git a/src/components/PaginationCursor/PaginationCursor.tsx b/src/components/PaginationCursor/PaginationCursor.tsx
new file mode 100644
index 0000000..bcbb555
--- /dev/null
+++ b/src/components/PaginationCursor/PaginationCursor.tsx
@@ -0,0 +1,30 @@
+import { plural, t } from '@lingui/macro';
+import styles from './PaginationCursor.module.scss';
+
+const PaginationCursor = ({
+  current,
+  total,
+}: {
+  current: number;
+  total: number;
+}) => {
+  return (
+    <div className={styles.wrapper}>
+      <progress
+        className={styles.bar}
+        max={total}
+        value={current}
+        aria-valuemin={0}
+        aria-valuemax={total}
+        aria-label={t`Number of articles loaded out of the total available.`}
+        title={plural(current, {
+          zero: `# articles out of a total of ${total}`,
+          one: `# article out of a total of ${total}`,
+          other: `# articles out of a total of ${total}`,
+        })}
+      ></progress>
+    </div>
+  );
+};
+
+export default PaginationCursor;
-- 
cgit v1.2.3

