Changeset 3734 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/client/components/front-page/plugin-section/index.jsx
- Timestamp:
- 07/28/2016 10:55:18 PM (9 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/client/components/front-page
- Files:
-
- 2 added
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/client/components/front-page/plugin-section/index.jsx
r3717 r3734 1 import React, { Component } from 'react'; 1 2 import { connect } from 'react-redux'; 2 3 … … 4 5 * Internal dependencies. 5 6 */ 6 import PluginSection from 'components/plugin-section'; 7 import { getBrowse } from 'actions'; 8 import PluginSection from './plugin-section'; 7 9 8 const mapStateToProps = () => ( { 9 plugins: [ 10 { 11 id: 0, 12 slug: 'zero', 13 title: { 14 rendered: 'Zero' 15 }, 16 excerpt: 'An excerpt for Zero', 17 rating: 4.5, 18 rating_count: 345 19 }, 20 { 21 id: 1, 22 slug: 'one', 23 title: { 24 rendered: 'One' 25 }, 26 excerpt: 'An excerpt for One', 27 rating: 4.5, 28 rating_count: 345 29 }, 30 { 31 id: 2, 32 slug: 'two', 33 title: { 34 rendered: 'Two' 35 }, 36 excerpt: 'An excerpt for Two', 37 rating: 4.5, 38 rating_count: 345 10 class PluginSectionContainer extends Component { 11 componentDidMount() { 12 this.getBrowse(); 13 } 14 15 componentDidUpdate( previousProps ) { 16 if ( this.props.section.type !== previousProps.section.type ) { 17 this.getBrowse(); 39 18 } 40 ] //todo 19 } 20 21 getBrowse() { 22 this.props.dispatch( getBrowse( this.props.section.type ) ); 23 } 24 25 render() { 26 return <PluginSection { ...this.props } />; 27 } 28 } 29 30 const mapStateToProps = ( state, ownProps ) => ( { 31 plugins: state.browse[ ownProps.section.type ].slice( 0, 4 ) 41 32 } ); 42 33 43 export default connect( mapStateToProps )( PluginSection );34 export default connect( mapStateToProps )( PluginSectionContainer );
Note: See TracChangeset
for help on using the changeset viewer.