Making WordPress.org


Ignore:
Timestamp:
03/01/2017 06:08:54 PM (8 years ago)
Author:
obenland
Message:

Plugin Directory: Update React client with latest changes.

This is largely a cleanup commit with some WIP around switching to node-wpapi.

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 */
     4import React, { PropTypes } from 'react';
     5import { connect } from 'react-redux';
     6import { identity } from 'lodash';
     7import { localize } from 'i18n-calypso';
    28
    3 export default React.createClass( {
    4     displayName: 'DonateWidget',
     9/**
     10 * Internal dependencies.
     11 */
     12import { getPlugin } from 'state/selectors';
    513
    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 */
     22export const DonateWidget = ( { plugin, translate } ) => {
     23    if ( plugin.donate_link ) {
    1124        return (
    1225            <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>
    1528                <p>
    16                     <a className="button button-secondary" href={ this.props.plugin.donate_link } rel="nofollow">
    17                         Donate to this plugin
     29                    <a className="button button-secondary" href={ plugin.donate_link } rel="nofollow">
     30                        { translate( 'Donate to this plugin' ) }
    1831                    </a>
    1932                </p>
    2033            </div>
    21         )
     34        );
    2235    }
    23 } );
     36
     37    return null;
     38};
     39
     40DonateWidget.propTypes = {
     41    plugin: PropTypes.object,
     42    translate: PropTypes.func,
     43};
     44
     45DonateWidget.defaultProps = {
     46    plugin: {},
     47    translate: identity,
     48};
     49
     50export default connect(
     51    ( state ) => ( {
     52        plugin: getPlugin( state ),
     53    } ),
     54)( localize( DonateWidget ) );
Note: See TracChangeset for help on using the changeset viewer.