Changeset 5024 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/client/components/archive/browse/browse.jsx
- Timestamp:
- 03/01/2017 06:08:54 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/client/components/archive/browse/browse.jsx
r4223 r5024 1 import React from 'react'; 1 /** 2 * External dependencies. 3 */ 4 import React, { PropTypes } from 'react'; 5 import { connect } from 'react-redux'; 6 import { identity } from 'lodash'; 7 import { localize } from 'i18n-calypso'; 2 8 9 /** 10 * Internal dependencies. 11 */ 3 12 import ContentNone from 'components/content-none'; 13 import { getSection, getSectionPlugins } from 'state/selectors'; 14 import Pagination from 'components/pagination'; 4 15 import PluginCard from 'components/plugin-card'; 5 16 6 export default React.createClass( { 7 displayName: 'ArchiveBrowse', 17 export const ArchiveBrowse = ( { plugins, section, translate } ) => { 18 if ( plugins && plugins.length ) { 19 return ( 20 <div> 21 <header className="page-header"> 22 <h1 className="page-title"> 23 { translate( 'Browse: {{strong}}%(name)s{{/strong}}', { 24 args: { name: section.name }, 25 components: { strong: <strong /> }, 26 } ) } 27 </h1> 28 { section.description && 29 <div className="taxonomy-description">{ section.description }</div> 30 } 31 </header> 32 { plugins.map( ( plugin ) => <PluginCard key={ plugin.id } plugin={ plugin } /> ) } 33 <Pagination current={ 12 } total={ 30 } /> 34 </div> 35 ); 36 } 8 37 9 render() { 10 if ( this.props.plugins && this.props.plugins.length ) { 11 return ( 12 <div> 13 <header className="page-header"> 14 <h1 className="page-title">Browse: <strong>{ this.props.params.type }</strong></h1> 15 <div className="taxonomy-description"></div> 16 </header> 17 { this.props.plugins.map( slug => 18 <PluginCard key={ slug } slug={ slug } /> 19 ) } 20 </div> 21 ) 22 } 38 return <ContentNone />; 39 }; 23 40 24 return <ContentNone { ...this.props } />; 25 } 26 } ); 41 ArchiveBrowse.propTypes = { 42 plugins: PropTypes.arrayOf( PropTypes.object ), 43 section: PropTypes.object, 44 translate: PropTypes.func, 45 type: PropTypes.string.isRequired, 46 }; 47 48 ArchiveBrowse.defaultProps = { 49 plugins: [], 50 section: {}, 51 translate: identity, 52 }; 53 54 export default connect( 55 ( state, { type } ) => ( { 56 plugins: getSectionPlugins( state, type ), 57 section: getSection( state, type ), 58 } ), 59 )( localize( ArchiveBrowse ) );
Note: See TracChangeset
for help on using the changeset viewer.