import classNames from 'classnames'; import React from 'react'; import { ColorImpairedConsumer } from 'App/ColorImpairedContext'; import { Kind } from 'Helpers/Props/kinds'; import { Size } from 'Helpers/Props/sizes'; import translate from 'Utilities/String/translate'; import styles from './ProgressBar.css'; interface ProgressBarProps { className?: string; containerClassName?: string; title?: string; progress: number; precision?: number; showText?: boolean; text?: string; kind?: Extract; size?: Extract; width?: number; } function ProgressBar({ className = styles.progressBar, containerClassName = styles.container, title, progress, precision = 1, showText = false, text, kind = 'primary', size = 'medium', width, }: ProgressBarProps) { const progressPercent = `${progress.toFixed(precision)}%`; const progressText = text || progressPercent; const actualWidth = width ? `${width}px` : '100%'; return ( {(enableColorImpairedMode) => { return (
{showText && width ? (
{progressText}
) : null}
{showText ? (
{progressText}
) : null}
); }} ); } export default ProgressBar;