Changeset 5024 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/client/components/widget-area/widgets/donate.jsx
- Timestamp:
- 03/01/2017 06:08:54 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/client/components/widget-area/widgets/donate.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 3 export default React.createClass( { 4 displayName: 'DonateWidget', 9 /** 10 * Internal dependencies. 11 */ 12 import { getPlugin } from 'state/selectors'; 5 13 6 render() { 7 if ( ! this.props.plugin.donate_link ) { 8 return <div />; 9 } 10 14 /** 15 * Donate Widget component. 16 * 17 * @param {Object} plugin Plugin object. 18 * @param {Function} translate Translation function. 19 * @return {*} Component or null. 20 * @constructor 21 */ 22 export const DonateWidget = ( { plugin, translate } ) => { 23 if ( plugin.donate_link ) { 11 24 return ( 12 25 <div className="widget plugin-donate"> 13 <h4 className="widget-title"> Donate</h4>14 <p className="aside"> Would you like to support the advancement of this plugin?</p>26 <h4 className="widget-title">{ translate( 'Donate' ) }</h4> 27 <p className="aside">{ translate( 'Would you like to support the advancement of this plugin?' ) }</p> 15 28 <p> 16 <a className="button button-secondary" href={ this.props.plugin.donate_link } rel="nofollow">17 Donate to this plugin29 <a className="button button-secondary" href={ plugin.donate_link } rel="nofollow"> 30 { translate( 'Donate to this plugin' ) } 18 31 </a> 19 32 </p> 20 33 </div> 21 ) 34 ); 22 35 } 23 } ); 36 37 return null; 38 }; 39 40 DonateWidget.propTypes = { 41 plugin: PropTypes.object, 42 translate: PropTypes.func, 43 }; 44 45 DonateWidget.defaultProps = { 46 plugin: {}, 47 translate: identity, 48 }; 49 50 export default connect( 51 ( state ) => ( { 52 plugin: getPlugin( state ), 53 } ), 54 )( localize( DonateWidget ) );
Note: See TracChangeset
for help on using the changeset viewer.