Changeset 5024 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/client/components/plugin/plugin.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/plugin/plugin.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'; 8 import { values } from 'lodash'; 2 9 10 /** 11 * Internal dependencies. 12 */ 3 13 import Developers from './sections/developers'; 4 14 import DonateWidget from 'components/widget-area/widgets/donate'; … … 6 16 import FAQ from './sections/faq'; 7 17 import FavoriteButton from './favorite-button'; 18 import { getPlugin } from 'state/selectors'; 8 19 import MetaWidget from 'components/widget-area/widgets/meta/index'; 9 20 import PluginBanner from './plugin-banner'; … … 15 26 import SupportWidget from 'components/widget-area/widgets/support/index'; 16 27 17 export default React.createClass( { 18 displayName: 'Plugin', 19 20 render() { 21 if ( ! this.props.plugin ) { 22 return ( 23 <article className="plugin type-plugin"> 24 <header className="entry-header"> 25 <h1 className="entry-title"> </h1> 26 </header> 27 <div className="entry-content"> 28 <section> 29 <div className="container"> LOADING </div> 30 </section> 31 </div> 32 </article> 33 ) 34 } 35 28 export const Plugin = ( { plugin, translate } ) => { 29 if ( ! plugin ) { 36 30 return ( 37 31 <article className="plugin type-plugin"> 38 <PluginBanner plugin={ this.props.plugin } /> 39 <header className="plugin-header"> 40 <PluginIcon plugin={ this.props.plugin } /> 41 <div className="plugin-actions"> 42 <FavoriteButton plugin={ this.props.plugin } /> 43 <DownloadButton plugin={ this.props.plugin } /> 44 </div> 45 <h1 className="plugin-title">{ this.props.plugin.name }</h1> 46 <span className="byline">By <span className="author vcard" dangerouslySetInnerHTML={ { __html: this.props.plugin.author } } /></span> 32 <header className="entry-header"> 33 <h1 className="entry-title"> </h1> 47 34 </header> 48 35 <div className="entry-content"> 49 <Section slug="description" title="Description" content={ this.props.plugin.sections.description } /> 50 <Screenshots screenshots={ this.props.plugin.screenshots } /> 51 <FAQ content={ this.props.plugin.sections.faq } /> 52 <Reviews slug={ this.props.plugin.slug } content={ this.props.plugin.sections.reviews } numRatings={ this.props.plugin.num_ratings } /> 53 <Section slug="changelog" title="Changelog" content={ this.props.plugin.sections.changelog } /> 54 <Developers slug={ this.props.plugin.slug } contributors={ this.props.plugin.contributors } /> 55 </div> 56 <div className="entry-meta"> 57 <MetaWidget plugin={ this.props.plugin } /> 58 <RatingsWidget plugin={ this.props.plugin } /> 59 <SupportWidget plugin={ this.props.plugin } /> 60 <DonateWidget plugin={ this.props.plugin } /> 36 <section> 37 <div className="container"> LOADING </div> 38 </section> 61 39 </div> 62 40 </article> 63 ) 41 ); 64 42 } 65 } ); 43 44 return ( 45 <article className="plugin type-plugin"> 46 <PluginBanner /> 47 <header className="plugin-header"> 48 <PluginIcon /> 49 <div className="plugin-actions"> 50 <FavoriteButton plugin={ plugin } /> 51 <DownloadButton /> 52 </div> 53 <h1 className="plugin-title" dangerouslySetInnerHTML={ { __html: plugin.title.rendered } } /> 54 <span className="byline"> 55 { translate( 'By {{span/}}', { components: { 56 span: <span className="author vcard" dangerouslySetInnerHTML={ { __html: plugin.author } } />, 57 } } ) } 58 </span> 59 </header> 60 <div className="entry-content"> 61 <Section slug="description" title="Description" content={ plugin.sections.description } /> 62 <Screenshots screenshots={ values( plugin.screenshots ) } /> 63 <FAQ content={ plugin.sections.faq } /> 64 <Reviews 65 slug={ plugin.slug } 66 content={ plugin.sections.reviews } 67 numRatings={ plugin.ratings.length } /> 68 <Section slug="changelog" title="Changelog" content={ plugin.sections.changelog } /> 69 <Developers /> 70 </div> 71 <div className="entry-meta"> 72 <MetaWidget /> 73 <RatingsWidget /> 74 <SupportWidget /> 75 <DonateWidget /> 76 </div> 77 </article> 78 ); 79 }; 80 81 Plugin.propTypes = { 82 plugin: PropTypes.object, 83 translate: PropTypes.func, 84 }; 85 86 Plugin.defaultProps = { 87 plugin: {}, 88 translate: identity, 89 }; 90 91 export default connect( 92 ( state ) => ( { 93 plugin: getPlugin( state ), 94 } ), 95 )( localize( Plugin ) );
Note: See TracChangeset
for help on using the changeset viewer.