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 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 */
     4import React, { PropTypes } from 'react';
     5import { withRouter } from 'react-router';
    26
     7/**
     8 * Internal dependencies.
     9 */
    310import SearchForm from 'components/search-form';
    411import SiteDescription from './site-description';
     
    613import MainNavigation from './main-navigation';
    714
    8 export default React.createClass( {
    9     displayName: 'SiteHeader',
     15export const SiteHeader = ( { router } ) => {
     16    const classes = [ 'site-header' ];
     17    const isHome = router.isActive( '/', true );
    1018
    11     render() {
    12         const classes = ['site-header'];
    13         classes.push( this.props.isHome ? 'home' : '' );
     19    if ( isHome ) {
     20        classes.push( 'home' );
     21    }
    1422
    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
     34SiteHeader.propTypes = {
     35    router: PropTypes.object,
     36};
     37
     38SiteHeader.defaultProps = {
     39    router: {},
     40};
     41
     42export default withRouter( SiteHeader );
Note: See TracChangeset for help on using the changeset viewer.