Changeset 3734 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/client/components/archive/browse/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/archive
- Files:
-
- 2 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/client/components/archive/browse/index.jsx
r3733 r3734 1 import React from 'react'; 1 import React, { Component } from 'react'; 2 import { connect } from 'react-redux'; 2 3 3 4 /** 4 5 * Internal dependencies. 5 6 */ 7 import { getBrowse } from 'actions'; 6 8 import ContentNone from 'components/content-none'; 9 import PluginCard from 'components/plugin-card'; 7 10 8 export default React.createClass( { 11 12 const ArchiveBrowse = React.createClass( { 9 13 displayName: 'ArchiveBrowse', 10 14 11 15 render() { 12 let content = <ContentNone { ...this.props } />; 13 14 if ( false /*this.props.plugins.length*/ ) { 15 content = <header className="page-header"> 16 <h1 className="page-title"></h1> 17 <div className="taxonomy-description"></div> 18 </header> 19 20 content += this.props.plugins.map( plugin => <PluginCard key={ plugin.slug } plugin={ plugin } /> ); 16 if ( this.props.plugins ) { 17 return ( 18 <div> 19 <header className="page-header"> 20 <h1 className="page-title">Browse: <strong>{ this.props.params.type }</strong></h1> 21 <div className="taxonomy-description"></div> 22 </header> 23 { this.props.plugins.map( slug => 24 <PluginCard key={ slug } slug={ slug } /> 25 ) } 26 </div> 27 ) 21 28 } 22 29 23 return ( 24 <div>{ content }</div> 25 ) 30 return <ContentNone { ...this.props } />; 26 31 } 27 32 } ); 33 34 class ArchiveBrowseContainer extends Component { 35 componentDidMount() { 36 this.getBrowse(); 37 } 38 39 componentDidUpdate( previousProps ) { 40 if ( this.props.params.type !== previousProps.params.type ) { 41 this.getBrowse(); 42 } 43 } 44 45 getBrowse() { 46 this.props.dispatch( getBrowse( this.props.params.type ) ); 47 } 48 49 render() { 50 return <ArchiveBrowse { ...this.props } />; 51 } 52 } 53 54 const mapStateToProps = ( state, ownProps ) => ( { 55 plugins: state.browse[ ownProps.params.type ] 56 } ); 57 58 export default connect( mapStateToProps )( ArchiveBrowseContainer ); 59 60
Note: See TracChangeset
for help on using the changeset viewer.