Changeset 5024 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/client/components/plugin/sections/screenshots/index.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/plugin/sections/screenshots/index.jsx
r4469 r5024 1 import React from 'react'; 2 import values from 'lodash/values'; 1 /** 2 * External dependencies. 3 */ 4 import React, { PropTypes } from 'react'; 5 //import { localize } from 'i18n-calypso'; 6 import { identity, map } from 'lodash'; 3 7 8 /** 9 * Internal dependencies. 10 */ 4 11 import ImageGallery from './image-gallery'; 5 12 6 export default React.createClass( { 7 displayName: 'Screenshots', 13 export 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 } ) ); 8 21 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 ) { 22 23 return ( 23 24 <div id="screenshots" className="plugin-screenshots"> 24 <h2> Screenshots</h2>25 <h2>{ translate( 'Screenshots' ) }</h2> 25 26 <ImageGallery items={ items } /> 26 27 </div> 27 ) 28 ); 28 29 } 29 } ); 30 31 return null; 32 }; 33 34 Screenshots.propTypes = { 35 screenshots: PropTypes.arrayOf( PropTypes.object ), 36 translate: PropTypes.func, 37 }; 38 39 Screenshots.defaultProps = { 40 screenshots: [], 41 translate: identity, 42 }; 43 44 //export default localize( Screenshots ); 45 export default Screenshots;
Note: See TracChangeset
for help on using the changeset viewer.