They've changed their default settings, this changes a lot of stuff in our code base.
25 lines
475 B
JavaScript
25 lines
475 B
JavaScript
import React from "react";
|
|
import PropTypes from "prop-types";
|
|
|
|
export const Rating = ({ rating, votes }) => {
|
|
if (rating === 0) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<span>
|
|
<i className="fa fa-star mr-1"></i>
|
|
{Number(rating).toFixed(1)}
|
|
{votes !== 0 && <small className="ml-1">({votes} votes)</small>}
|
|
</span>
|
|
);
|
|
};
|
|
Rating.propTypes = {
|
|
rating: PropTypes.number,
|
|
votes: PropTypes.number,
|
|
};
|
|
Rating.defaultProps = {
|
|
rating: 0,
|
|
votes: 0,
|
|
};
|