Making WordPress.org


Ignore:
Timestamp:
08/02/2016 07:37:38 PM (8 years ago)
Author:
obenland
Message:

Plugin Directory: Add search functionality to React client.

See #1719.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/client/components/plugin-card/index.jsx

    r3745 r3764  
    1 import React, { Component } from 'react';
     1import React from 'react';
    22import { connect } from 'react-redux';
    33import find from 'lodash/find';
    4 import { Link } from 'react-router';
    54
    65/**
    76 * Internal dependencies.
    87 */
     8import PluginCard from './plugin-card';
    99import { getPlugin } from 'actions';
    10 import PluginIcon from 'components/plugin-icon';
    11 import PluginRatings from 'components/plugin-ratings';
    1210
    13 const PluginCard = React.createClass( {
    14     displayName: 'PluginCard',
    15 
    16     render() {
    17         if ( ! this.props.plugin ) {
    18             return (
    19                 <div />
    20             );
    21         }
    22 
    23         return (
    24             <article className="plugin type-plugin">
    25                 <PluginIcon plugin={ this.props.plugin } />
    26                 <div className="entry">
    27                     <header className="entry-header">
    28                         <h2 className="entry-title">
    29                             <Link to={ this.props.plugin.slug } rel="bookmark">{ this.props.plugin.name }</Link>
    30                         </h2>
    31                     </header>
    32 
    33                     <PluginRatings rating={ this.props.plugin.rating } ratingCount={ this.props.plugin.num_ratings } />
    34 
    35                     <div className="entry-excerpt">{ this.props.plugin.short_description }</div>
    36                 </div>
    37             </article>
    38         )
    39     }
    40 } );
    41 
    42 class PluginCardContainer extends Component {
     11const PluginCardContainer = React.createClass( {
    4312    componentDidMount() {
    4413        this.getPlugin();
    45     }
     14    },
    4615
    4716    componentDidUpdate( previousProps ) {
     
    4918            this.getPlugin();
    5019        }
    51     }
     20    },
    5221
    5322    getPlugin() {
    5423        this.props.dispatch( getPlugin( this.props.slug ) );
    55     }
     24    },
    5625
    5726    render() {
    5827        return <PluginCard { ...this.props } />;
    5928    }
    60 }
     29} );
    6130
    6231const mapStateToProps = ( state, ownProps ) => ( {
Note: See TracChangeset for help on using the changeset viewer.