woocommerce/plugins/woocommerce-admin/client/components/rating/review.js

32 lines
643 B
JavaScript
Raw Normal View History

/** @format */
/**
* External dependencies
*/
import PropTypes from 'prop-types';
/**
* Internal dependencies
*/
import Rating from './index';
/**
* Display a set of stars representing the review's rating.
*
* @return { object } -
*/
const ReviewRating = ( { review, ...props } ) => {
const rating = ( review && review.rating ) || 0;
return <Rating rating={ rating } { ...props } />;
};
ReviewRating.propTypes = {
/**
* A review object containing a `rating`.
* See https://woocommerce.github.io/woocommerce-rest-api-docs/#retrieve-product-reviews.
*/
review: PropTypes.object.isRequired,
};
export default ReviewRating;