Changeset 5024 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/client/components/plugin/sections/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/index.jsx
r4464 r5024 1 import React from 'react'; 1 /** 2 * External dependencies. 3 */ 4 import React, { PropTypes } from 'react'; 5 import { identity } from 'lodash'; 6 import { localize } from 'i18n-calypso'; 2 7 3 export default React.createClass( { 4 displayName: 'Section', 8 export const Section = ( { content, slug, title, translate } ) => ( 9 <div> 10 <div id={ slug } className={ `section read-more plugin-${ slug }` }> 11 <h2>{ title }</h2> 12 <div dangerouslySetInnerHTML={ { __html: content } } /> 13 </div> 14 <button 15 type="button" 16 className="button-link section-toggle" 17 aria-controls={ slug } 18 aria-expanded="false" 19 data-show-less={ translate( 'Show less' ) } 20 data-read-more={ translate( 'Read more' ) } 21 > 22 { translate( 'Read more' ) } 23 </button> 24 </div> 25 ); 5 26 6 render(){7 return (8 <div>9 <div id={ this.props.slug } className="section read-more">10 <h2>{ this.props.title }</h2>11 <div dangerouslySetInnerHTML={ { __html: this.props.content } } /> 12 </div> 13 <button type="button" className="button-link section-toggle" aria-controls={ this.props.slug } aria-expanded="false">Read more</button> 14 </div>15 ) 16 } 17 });27 Section.propTypes = { 28 content: PropTypes.string.isRequired, 29 slug: PropTypes.string.isRequired, 30 title: PropTypes.string.isRequired, 31 translate: PropTypes.func, 32 }; 33 34 Section.defaultProps = { 35 translate: identity, 36 }; 37 38 export default localize( Section );
Note: See TracChangeset
for help on using the changeset viewer.