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/plugin/download-button/index.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: 'DownloadButton',
     9/**
     10 * Internal dependencies.
     11 */
     12import { getPlugin } from 'state/selectors';
    513
    6     render() {
    7         return (
    8             <span>
    9                 <a className="plugin-download button download-button button-large" href={ this.props.plugin.download_link } itemProp="downloadUrl">
    10                     Download
    11                 </a>
    12                 <meta itemProp="softwareVersion" content={ this.props.plugin.version } />
    13                 <meta itemProp="fileFormat" content="application/zip" />
    14             </span>
    15         )
    16     }
    17 } );
     14export const DownloadButton = ( { plugin, translate } ) => (
     15    <span>
     16        <a
     17            className="plugin-download button download-button button-large"
     18            href={ plugin.download_link }
     19            itemProp="downloadUrl"
     20        >
     21            { translate( 'Download' ) }
     22        </a>
     23        <meta itemProp="softwareVersion" content={ plugin.version } />
     24        <meta itemProp="fileFormat" content="application/zip" />
     25    </span>
     26);
     27
     28DownloadButton.propTypes = {
     29    plugin: PropTypes.object,
     30    translate: PropTypes.func,
     31};
     32
     33DownloadButton.defaultProps = {
     34    plugin: {},
     35    translate: identity,
     36};
     37
     38export default connect(
     39    ( state ) => ( {
     40        plugin: getPlugin( state ),
     41    } ),
     42)( localize( DownloadButton ) );
Note: See TracChangeset for help on using the changeset viewer.