2018-07-23 13:19:24 +00:00
|
|
|
/** @format */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2018-08-20 21:18:13 +00:00
|
|
|
import Rating from './index';
|
2018-07-23 13:19:24 +00:00
|
|
|
|
2018-08-20 21:18:13 +00:00
|
|
|
const ProductRating = ( { product, ...props } ) => {
|
|
|
|
const rating = ( product && product.average_rating ) || 0;
|
|
|
|
return <Rating rating={ rating } { ...props } />;
|
|
|
|
};
|
2018-07-23 13:19:24 +00:00
|
|
|
|
|
|
|
ProductRating.propTypes = {
|
|
|
|
product: PropTypes.object.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ProductRating;
|