forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgressBar.tsx
More file actions
38 lines (35 loc) · 1.19 KB
/
ProgressBar.tsx
File metadata and controls
38 lines (35 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import styles from '@patternfly/react-styles/css/components/Progress/progress';
import { css } from '@patternfly/react-styles';
export interface AriaProps {
'aria-labelledby'?: string;
'aria-label'?: string;
'aria-describedby'?: string;
'aria-valuemin'?: number;
'aria-valuenow'?: number;
'aria-valuemax'?: number;
'aria-valuetext'?: string;
}
export interface ProgressBarProps extends React.HTMLProps<HTMLDivElement> {
/** What should be rendered inside progress bar. */
children?: React.ReactNode;
/** Additional classes for Progres bar. */
className?: string;
/** Actual progress value. */
value: number;
/** Minimal value of progress. */
progressBarAriaProps?: AriaProps;
}
export const ProgressBar: React.FunctionComponent<ProgressBarProps> = ({
progressBarAriaProps,
className = '',
children = null,
value,
...props
}: ProgressBarProps) => (
<div role="progressbar" {...props} className={css(styles.progressBar, className)} {...progressBarAriaProps}>
<div className={css(styles.progressIndicator)} style={{ width: `${value}%` }}>
<span className={css(styles.progressMeasure)}>{children}</span>
</div>
</div>
);
ProgressBar.displayName = 'ProgressBar';