summaryrefslogtreecommitdiffstats
path: root/src/components/atoms/loaders/progress-bar.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/atoms/loaders/progress-bar.tsx')
-rw-r--r--src/components/atoms/loaders/progress-bar.tsx55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/components/atoms/loaders/progress-bar.tsx b/src/components/atoms/loaders/progress-bar.tsx
new file mode 100644
index 0000000..fa4e09d
--- /dev/null
+++ b/src/components/atoms/loaders/progress-bar.tsx
@@ -0,0 +1,55 @@
+import { FC } from 'react';
+import styles from './progress-bar.module.scss';
+
+export type ProgressBarProps = {
+ /**
+ * Accessible progress bar name.
+ */
+ ariaLabel?: string;
+ /**
+ * Current value.
+ */
+ current: number;
+ /**
+ * Additional information to display before progress bar.
+ */
+ info?: string;
+ /**
+ * Minimal value.
+ */
+ min: number;
+ /**
+ * Maximal value.
+ */
+ max: number;
+};
+
+/**
+ * ProgressBar component
+ *
+ * Render a progress bar.
+ */
+const ProgressBar: FC<ProgressBarProps> = ({
+ ariaLabel,
+ current,
+ info,
+ min,
+ max,
+}) => {
+ return (
+ <div className={styles.progress}>
+ {info && <div className={styles.progress__info}>{info}</div>}
+ <progress
+ className={styles.progress__bar}
+ max={max}
+ value={current}
+ aria-valuemin={min}
+ aria-valuemax={max}
+ aria-valuenow={current}
+ aria-label={ariaLabel}
+ ></progress>
+ </div>
+ );
+};
+
+export default ProgressBar;