Changeset 5024 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/client/components/plugin-ratings/index.jsx
- Timestamp:
- 03/01/2017 06:08:54 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/client/components/plugin-ratings/index.jsx
r4223 r5024 1 import React from 'react'; 1 /** 2 * External dependencies. 3 */ 4 import React, { PropTypes } from 'react'; 5 import { localize } from 'i18n-calypso'; 6 import { identity } from 'lodash'; 2 7 3 8 /** … … 6 11 import Stars from './stars'; 7 12 8 export default React.createClass( { 9 displayName: 'PluginRatings', 13 export const PluginRatings = ( { numberFormat, rating, ratingCount, translate } ) => ( 14 <div className="plugin-rating" itemProp="aggregateRating" itemScope="" itemType="http://schema.org/AggregateRating"> 15 <meta itemProp="ratingCount" content={ ratingCount } /> 16 <meta itemProp="ratingValue" content={ rating } /> 10 17 11 render() { 12 return ( 13 <div className="plugin-rating" itemProp="aggregateRating" itemScope="" itemType="http://schema.org/AggregateRating"> 14 <meta itemProp="ratingCount" content={ this.props.ratingCount } /> 15 <meta itemProp="ratingValue" content={ this.props.rating } /> 18 <Stars rating={ rating } /> 19 <span className="rating-count"> 20 { translate( '(%(count)s{{span}} total ratings{{/span}})', { 21 args: { count: numberFormat( ratingCount ) }, 22 components: { span: <span className="screen-reader-text" /> }, 23 } ) } 24 </span> 25 </div> 26 ); 16 27 17 <Stars rating={ this.props.rating } /> 18 <span className="rating-count">({ this.props.ratingCount }<span className="screen-reader-text"> total ratings</span>)</span> 19 </div> 20 ) 21 } 22 } ); 28 PluginRatings.propTypes = { 29 numberFormat: PropTypes.func, 30 rating: PropTypes.number, 31 ratingCount: PropTypes.number, 32 translate: PropTypes.func, 33 }; 34 35 PluginRatings.defaultProps = { 36 numberFormat: identity, 37 rating: 0, 38 ratingCount: 0, 39 translate: identity, 40 }; 41 42 export default localize( PluginRatings );
Note: See TracChangeset
for help on using the changeset viewer.