Making WordPress.org


Ignore:
Timestamp:
03/01/2017 06:08:54 PM (8 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/sections/reviews/index.jsx

    r4464 r5024  
    1 import React from 'react';
     1/**
     2 * External dependencies.
     3 */
     4import React, { PropTypes } from 'react';
     5import { identity } from 'lodash';
     6import { localize } from 'i18n-calypso';
    27
    3 export default React.createClass( {
    4     displayName: 'Reviews',
     8export const Reviews = ( { content, numberFormat, numRatings, slug, translate } ) => {
     9    if ( ! numRatings ) {
     10        return null;
     11    }
    512
    6     render() {
    7         return (
    8             <div>
    9                 <div id="reviews" className="read-more">
    10                     <div className="plugin-reviews">
    11                         <h2>Reviews</h2>
    12                         <div dangerouslySetInnerHTML={ { __html: this.props.content } } />
    13                     </div>
     13    return (
     14        <div>
     15            <div id="reviews" className="section">
     16                <div className="plugin-reviews">
     17                    <h2>{ translate( 'Reviews' ) }</h2>
     18                    <div dangerouslySetInnerHTML={ { __html: content } }/>
    1419                </div>
    15                 <a className="reviews-link" href={ `https://wordpress.org/support/plugin/${ this.props.slug }/reviews/` } aria-expanded="false">Read all { this.props.numRatings } reviews</a>
    1620            </div>
    17         )
    18     }
    19 } );
     21            <a
     22                className="reviews-link"
     23                href={ `https://wordpress.org/support/plugin/${ slug }/reviews/` }
     24                aria-expanded="false"
     25            >
     26                { translate( 'Read all %(numRatings)s reviews', {
     27                    args: { numRatings: numberFormat( numRatings ) },
     28                } ) }
     29            </a>
     30        </div>
     31    );
     32};
     33
     34Reviews.propTypes = {
     35    content: PropTypes.string,
     36    numberFormat: PropTypes.func,
     37    numRatings: PropTypes.number.isRequired,
     38    slug: PropTypes.string.isRequired,
     39    translate: PropTypes.func,
     40};
     41
     42Reviews.defaultProps = {
     43    content: null,
     44    numberFormat: identity,
     45    translate: identity,
     46};
     47
     48export default localize( Reviews );
Note: See TracChangeset for help on using the changeset viewer.