-
Notifications
You must be signed in to change notification settings - Fork 12
/
ProgressBar.js
40 lines (38 loc) · 1002 Bytes
/
ProgressBar.js
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
39
40
import React from 'react';
var ProgressBar = React.createClass({
propTypes: {
n: React.PropTypes.number.isRequired,
label: React.PropTypes.bool,
striped: React.PropTypes.bool,
animated: React.PropTypes.bool,
type: React.PropTypes.oneOf([
'success',
'info',
'warning',
'danger'
])
},
render() {
var {n, label, striped, animated, type} = this.props;
return (
<div className="progress">
<div
className={[
"progress-bar",
striped ? "progress-bar-striped" : "",
type ? "progress-bar-" + type : "",
animated ? "active" : ""
].join(" ")}
role="progressbar"
aria-valuemin="0" aria-valuemax="100"
aria-valuenow={n}
style={{ width: n + "%", minWidth: "2em" }}
>
{label ? n + "%" :
<span className="sr-only">{n + "%"}</span>}
</div>
</div>
);
}
});
export default ProgressBar;