import { FC, WebCellProps } from 'web-cell'; import { JsxChildren } from 'dom-renderer'; import { isEmpty } from 'web-utility'; import classNames from 'classnames'; import { Status } from '../type'; export interface ProgressBarProps extends WebCellProps, Partial> { striped?: boolean; animated?: boolean; variant?: keyof typeof Status; label?: boolean | ((now: number) => JsxChildren); } export const ProgressBar: FC = ({ className = '', striped, animated, variant = 'primary', min = 0, max = 100, now = min, label, children }) => isEmpty(children) ? (
{typeof label === 'function' ? label(now) : label && `${now}%`}
) : (
{children}
);