alm
Version:
The best IDE for TypeScript
45 lines (44 loc) • 1.73 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var Progress = /** @class */ (function (_super) {
__extends(Progress, _super);
function Progress() {
return _super !== null && _super.apply(this, arguments) || this;
}
Progress.prototype.render = function () {
var _a = this.props, current = _a.current, total = _a.total;
var percent = total == 0 ? 100 : (current / total * 100);
if (percent < 0) {
percent = 0;
}
;
var parentStyle = {
textAlign: 'center',
fontSize: '.6em',
fontWeight: 'bold',
color: 'white',
border: '1px solid white',
};
var childStyle = {
backgroundColor: '#0BD318',
width: percent + '%',
transition: "width 200ms",
padding: '5px 10px',
};
return (React.createElement("div", { className: "progressbar-container", style: parentStyle },
React.createElement("div", { className: "progressbar-progress", style: childStyle }, this.props.children)));
};
return Progress;
}(React.Component));
exports.Progress = Progress;