Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
Ran release and removed logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderEerenberg committed Dec 13, 2018
1 parent cae684e commit 64a9532
Show file tree
Hide file tree
Showing 6 changed files with 7,581 additions and 2,090 deletions.
7 changes: 6 additions & 1 deletion dist/ProgressBar.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/// <reference types="react" />
import * as React from 'react';
export interface Props {
currentTime: number;
duration: number;
percentage: number;
hideProgressBarCurrentTime: boolean;
hideProgressBarDuration: boolean;
onElapsedTimeUpdate: (...args: any[]) => void;
autoPlay: boolean;
isBuffering: boolean;
Expand All @@ -17,5 +18,9 @@ export default class ProgressBar extends React.Component<Props, any> {
props: Props;
private progressBar;
constructor(props: Props);
/**
* Convert seconds (number) to a human readable time format: 2u 3m 34s
*/
convertToReadableTime: (seconds: number) => string;
render(): JSX.Element;
}
22 changes: 19 additions & 3 deletions dist/ProgressBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,38 @@ var ProgressBar = /** @class */ (function (_super) {
__extends(ProgressBar, _super);
function ProgressBar(props) {
var _this = _super.call(this, props) || this;
/**
* Convert seconds (number) to a human readable time format: 2u 3m 34s
*/
_this.convertToReadableTime = function (seconds) {
var h = Math.floor(seconds / 3600);
var m = Math.floor(seconds % 3600 / 60);
var s = Math.floor(seconds % 3600 % 60);
var hDisplay = h > 0 ? h + "u " : "";
var mDisplay = m > 0 ? m + "m " : "";
var sDisplay = s > 0 ? s + "s" : "";
return hDisplay + mDisplay + sDisplay;
};
_this.props = props;
return _this;
}
ProgressBar.prototype.render = function () {
var _this = this;
console.log(this.props.hideProgressBarCurrentTime, this.props.hideProgressBarDuration);
var spinner = this.props.isBuffering ? (React.createElement("div", { className: "loader" },
React.createElement("div", { className: "double-bounce1" }),
React.createElement("div", { className: "double-bounce2" }))) : "";
var timeLine = this.props.hideTimeLine ? "" : (React.createElement("div", { className: "time-line" },
React.createElement("span", { className: "time-line-progress-bar", style: { width: this.props.percentage + "%" } }, spinner),
React.createElement("input", { ref: function (progressBar) { _this.progressBar = progressBar; }, type: "range", step: "0.01", value: this.props.percentage, onInput: this.props.onElapsedTimeUpdate, onChange: this.props.onElapsedTimeUpdate })));
var currentTime = this.props.hideProgressBarCurrentTime ? "" : (React.createElement("span", null, (this.props.currentTime === 0) ? "" : this.convertToReadableTime(this.props.currentTime)));
var duration = this.props.hideProgressBarDuration ? "" : (React.createElement("span", null, (this.props.duration === 0) ? "" : this.convertToReadableTime(this.props.duration)));
var counters = this.props.hideProgressBarCurrentTime && this.props.hideProgressBarDuration ? "" : (React.createElement("div", { className: "counters" },
currentTime,
duration));
return (React.createElement("div", { className: "progress" },
React.createElement("div", null, timeLine),
React.createElement("div", { className: "counters" },
React.createElement("span", null, (this.props.currentTime === 0) ? "" : this.props.currentTime),
React.createElement("span", null, (this.props.duration === 0) ? "" : this.props.duration))));
counters));
};
return ProgressBar;
}(React.Component));
Expand Down
Loading

0 comments on commit 64a9532

Please sign in to comment.