summaryrefslogtreecommitdiffstats
path: root/src/components/PaginationCursor
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/PaginationCursor')
-rw-r--r--src/components/PaginationCursor/PaginationCursor.module.scss28
-rw-r--r--src/components/PaginationCursor/PaginationCursor.tsx30
2 files changed, 58 insertions, 0 deletions
diff --git a/src/components/PaginationCursor/PaginationCursor.module.scss b/src/components/PaginationCursor/PaginationCursor.module.scss
new file mode 100644
index 0000000..35484ea
--- /dev/null
+++ b/src/components/PaginationCursor/PaginationCursor.module.scss
@@ -0,0 +1,28 @@
+@use "@styles/abstracts/functions" as fun;
+
+.wrapper {
+ margin: var(--spacing-sm) auto var(--spacing-md);
+ width: max-content;
+
+ .bar[value] {
+ display: block;
+ width: 30ch;
+ height: fun.convert-px(13);
+ appearance: none;
+ background: var(--color-bg-tertiary);
+ border: fun.convert-px(1) solid var(--color-primary-darker);
+ border-radius: 1em;
+ box-shadow: inset 0 0 fun.convert-px(4) fun.convert-px(1)
+ var(--color-shadow-light);
+
+ &::-webkit-progress-value {
+ background-color: var(--color-primary-dark);
+ border-radius: 1em;
+ }
+
+ &::-moz-progress-bar {
+ background-color: var(--color-primary-dark);
+ border-radius: 1em;
+ }
+ }
+}
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;