Changeset 3764 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/client/components/plugin-card/index.jsx
- Timestamp:
- 08/02/2016 07:37:38 PM (8 years ago)
- 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';1 import React from 'react'; 2 2 import { connect } from 'react-redux'; 3 3 import find from 'lodash/find'; 4 import { Link } from 'react-router';5 4 6 5 /** 7 6 * Internal dependencies. 8 7 */ 8 import PluginCard from './plugin-card'; 9 9 import { getPlugin } from 'actions'; 10 import PluginIcon from 'components/plugin-icon';11 import PluginRatings from 'components/plugin-ratings';12 10 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 { 11 const PluginCardContainer = React.createClass( { 43 12 componentDidMount() { 44 13 this.getPlugin(); 45 } 14 }, 46 15 47 16 componentDidUpdate( previousProps ) { … … 49 18 this.getPlugin(); 50 19 } 51 } 20 }, 52 21 53 22 getPlugin() { 54 23 this.props.dispatch( getPlugin( this.props.slug ) ); 55 } 24 }, 56 25 57 26 render() { 58 27 return <PluginCard { ...this.props } />; 59 28 } 60 } 29 } ); 61 30 62 31 const mapStateToProps = ( state, ownProps ) => ( {
Note: See TracChangeset
for help on using the changeset viewer.