Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 6 additions & 23 deletions app/components/Progress.jsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,14 @@
'use strict';

import React, { Component } from 'react';
import React from 'react';

function workOutProgressValue(duration, currentTime) {
const difference = (duration - currentTime);
const remainingTime = (duration - difference);
const progressPercentage = (remainingTime / duration) * 100;

return progressPercentage;
}

class Progress extends Component {
render() {
const progress = workOutProgressValue(this.props.duration, this.props.currentTime);

return (<progress value={progress} max={this.props.max}></progress>);
}
}

Progress.defaultProps = {
max: 100
};
const Progress = (props) => (
<progress value={this.props.currentTime} max={this.props.duration} />
)

Progress.propTypes = {
duration: React.PropTypes.number,
currentTime: React.PropTypes.number,
max: React.PropTypes.number
duration: React.PropTypes.number.isRequired,
currentTime: React.PropTypes.number.isRequired
};

export default Progress;