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/sections/screenshots/index.jsx

    r4469 r5024  
    1 import React from 'react';
    2 import values from 'lodash/values';
     1/**
     2 * External dependencies.
     3 */
     4import React, { PropTypes } from 'react';
     5//import { localize } from 'i18n-calypso';
     6import { identity, map } from 'lodash';
    37
     8/**
     9 * Internal dependencies.
     10 */
    411import ImageGallery from './image-gallery';
    512
    6 export default React.createClass( {
    7     displayName: 'Screenshots',
     13export const Screenshots = ( { screenshots, translate } ) => {
     14    const items = map( screenshots, ( { caption, src } ) => ( {
     15        original: src,
     16        originalAlt: '',
     17        thumbnail: src + '&width=100',
     18        thumbnailAlt: caption || '',
     19        description: caption || false,
     20    } ) );
    821
    9     render() {
    10         const items = values( this.props.screenshots ).map( ( { caption, src } ) => ( {
    11             original: src,
    12             originalAlt: '',
    13             thumbnail: src + '&width=100',
    14             thumbnailAlt: caption || '',
    15             description: caption || false,
    16         } ) );
    17 
    18         if ( ! items ) {
    19             return;
    20         }
    21 
     22    if ( items ) {
    2223        return (
    2324            <div id="screenshots" className="plugin-screenshots">
    24                 <h2>Screenshots</h2>
     25                <h2>{ translate( 'Screenshots' ) }</h2>
    2526                <ImageGallery items={ items } />
    2627            </div>
    27         )
     28        );
    2829    }
    29 } );
     30
     31    return null;
     32};
     33
     34Screenshots.propTypes = {
     35    screenshots: PropTypes.arrayOf( PropTypes.object ),
     36    translate: PropTypes.func,
     37};
     38
     39Screenshots.defaultProps = {
     40    screenshots: [],
     41    translate: identity,
     42};
     43
     44//export default localize( Screenshots );
     45export default Screenshots;
Note: See TracChangeset for help on using the changeset viewer.