diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-25 11:47:59 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-25 11:49:56 +0100 |
| commit | 71942c86311a9d1ddf4ae486d811f8393786e855 (patch) | |
| tree | 4e14e1f1ff083dabbb483ba2f12874666c1d6ced /src/components/PaginationCursor/PaginationCursor.tsx | |
| parent | 82702fbe2d0607e7ca8a02c878b2e79a21664b7c (diff) | |
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.
Diffstat (limited to 'src/components/PaginationCursor/PaginationCursor.tsx')
| -rw-r--r-- | src/components/PaginationCursor/PaginationCursor.tsx | 30 |
1 files changed, 30 insertions, 0 deletions
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; |
