Add a prettier runtime string for movies
This commit is contained in:
parent
20ca2adefc
commit
eae4598c88
@ -47,14 +47,22 @@ ListDetails.propTypes = {
|
|||||||
export default ListDetails;
|
export default ListDetails;
|
||||||
|
|
||||||
const Runtime = (props) => {
|
const Runtime = (props) => {
|
||||||
if (props.runtime === undefined) {
|
if (props.runtime === undefined || props.runtime === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const hours = Math.floor(props.runtime / 60);
|
||||||
|
const minutes = (props.runtime % 60);
|
||||||
|
|
||||||
|
let duration = "";
|
||||||
|
if (hours > 0) { duration += hours + "h" }
|
||||||
|
if (minutes > 0) { duration += ("0" + minutes).slice(-2) }
|
||||||
|
if (hours === 0) { duration += " min" }
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<p>
|
<p>
|
||||||
<i className="fa fa-clock-o"></i>
|
<i className="fa fa-clock-o"></i>
|
||||||
{props.runtime} min
|
{duration}
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user