Making WordPress.org


Ignore:
Timestamp:
03/01/2017 06:08:54 PM (10 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-card/plugin-card.jsx

    r4223 r5024  
    1 import React from 'react';
     1/**
     2 * External dependencies.
     3 */
     4import React, { PropTypes } from 'react';
    25import { Link } from 'react-router';
    36
    … …  
    811import PluginRatings from 'components/plugin-ratings';
    912
    10 export default React.createClass( {
    11         displayName: 'PluginCard',
     13export const PluginCard = ( { plugin } ) => (
     14        <article className="plugin type-plugin plugin-card">
     15                <PluginIcon slug={ plugin.slug } />
     16                <div className="entry">
     17                        <header className="entry-header">
     18                                <h2 className="entry-title">
     19                                        <Link
     20                                                to={ `${ plugin.slug }/` }
     21                                                rel="bookmark"
     22                                                dangerouslySetInnerHTML={ { __html: plugin.title.rendered } }
     23                                        />
     24                                </h2>
     25                        </header>
    1226
    13         render() {
    14                 if ( ! this.props.plugin ) {
    15                         return (
    16                                 <div />
    17                         );
    18                 }
     27                        { plugin.ratings && <PluginRatings rating={ plugin.meta.rating } ratingCount={ plugin.ratings.length } /> }
    1928
    20                 return (
    21                         <article className="plugin type-plugin plugin-card">
    22                                 <PluginIcon plugin={ this.props.plugin } />
    23                                 <div className="entry">
    24                                         <header className="entry-header">
    25                                                 <h2 className="entry-title">
    26                                                         <Link to={ `${ this.props.plugin.slug }/` } rel="bookmark">{ this.props.plugin.name }</Link>
    27                                                 </h2>
    28                                         </header>
     29                        <div className="entry-excerpt" dangerouslySetInnerHTML={ { __html: plugin.excerpt.rendered } } />
     30                </div>
     31        </article>
     32);
    2933
    30                                         <PluginRatings rating={ this.props.plugin.rating } ratingCount={ this.props.plugin.num_ratings } />
     34PluginCard.propTypes = {
     35        plugin: PropTypes.object,
     36};
    3137
    32                                         <div className="entry-excerpt">{ this.props.plugin.short_description }</div>
    33                                 </div>
    34                         </article>
    35                 )
    36         }
    37 } );
     38export default PluginCard;
Note: See TracChangeset for help on using the changeset viewer.