Making WordPress.org


Ignore:
Timestamp:
03/01/2017 06:08:54 PM (7 years ago)
Author:
obenland
Message:

Plugin Directory: Update React client with latest changes.

This is largely a cleanup commit with some WIP around switching to node-wpapi.

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 */
     4import React, { PropTypes } from 'react';
     5import { localize } from 'i18n-calypso';
     6import { identity } from 'lodash';
    27
    38/**
     
    611import Stars from './stars';
    712
    8 export default React.createClass( {
    9     displayName: 'PluginRatings',
     13export 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 } />
    1017
    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);
    1627
    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 } );
     28PluginRatings.propTypes = {
     29    numberFormat: PropTypes.func,
     30    rating: PropTypes.number,
     31    ratingCount: PropTypes.number,
     32    translate: PropTypes.func,
     33};
     34
     35PluginRatings.defaultProps = {
     36    numberFormat: identity,
     37    rating: 0,
     38    ratingCount: 0,
     39    translate: identity,
     40};
     41
     42export default localize( PluginRatings );
Note: See TracChangeset for help on using the changeset viewer.