Changeset 5024 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/client/components/site-header/index.jsx
- Timestamp:
- 03/01/2017 06:08:54 PM (8 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/client/components/site-header/index.jsx
r5023 r5024 1 import React from 'react'; 1 /** 2 * External dependencies. 3 */ 4 import React, { PropTypes } from 'react'; 5 import { withRouter } from 'react-router'; 2 6 7 /** 8 * Internal dependencies. 9 */ 3 10 import SearchForm from 'components/search-form'; 4 11 import SiteDescription from './site-description'; … … 6 13 import MainNavigation from './main-navigation'; 7 14 8 export default React.createClass( { 9 displayName: 'SiteHeader', 15 export const SiteHeader = ( { router } ) => { 16 const classes = [ 'site-header' ]; 17 const isHome = router.isActive( '/', true ); 10 18 11 render() {12 c onst classes = ['site-header'];13 classes.push( this.props.isHome ? 'home' : '' );19 if ( isHome ) { 20 classes.push( 'home' ); 21 } 14 22 15 return ( 16 <header id="masthead" className={ classes.join( ' ' ) } role="banner"> 17 <div className="site-branding"> 18 <SiteTitle isHome={ this.props.isHome } /> 19 <SiteDescription isHome={ this.props.isHome } /> 20 { this.props.isHome ? <SearchForm searchTerm={ this.props.searchTerm } /> : <MainNavigation searchTerm={ this.props.searchTerm } /> } 21 </div> 22 </header> 23 ) 24 } 25 } ); 23 return ( 24 <header id="masthead" className={ classes.join( ' ' ) } role="banner"> 25 <div className="site-branding"> 26 <SiteTitle /> 27 <SiteDescription /> 28 { isHome ? <SearchForm /> : <MainNavigation /> } 29 </div> 30 </header> 31 ); 32 }; 33 34 SiteHeader.propTypes = { 35 router: PropTypes.object, 36 }; 37 38 SiteHeader.defaultProps = { 39 router: {}, 40 }; 41 42 export default withRouter( SiteHeader );
Note: See TracChangeset
for help on using the changeset viewer.