-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In progress: heavy refactoring, part 1.
Masterbar structure was very complicated, both on React and on CSS side. This refactoring will clear up both the issues. And introduce Gridicons.
- Loading branch information
Showing
3 changed files
with
259 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
import noop from 'lodash/utility/noop'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Gridicon from 'components/gridicon'; | ||
|
||
import MasterbarLoggedOutMenu from './masterbar-logged-out-menu'; | ||
import MasterbarSectionsMenu from './masterbar-sections-menu'; | ||
import Notifications from 'notifications'; | ||
import store from 'store'; | ||
|
||
export default React.createClass( { | ||
displayName: 'MasterbarItem', | ||
|
||
propTypes: { | ||
url: React.PropTypes.string, | ||
onClick: React.PropTypes.func, | ||
tooltip: React.PropTypes.string, | ||
icon: React.PropTypes.string, | ||
className: React.PropTypes.string, | ||
isActive: React.PropTypes.bool | ||
}, | ||
|
||
getDefaultProps: function() { | ||
return { | ||
icon: '', | ||
onClick: noop | ||
}; | ||
}, | ||
|
||
render() { | ||
var itemClasses = classNames( 'masterbar__item', this.props.className, { | ||
'is-active': this.props.isActive, | ||
} ); | ||
|
||
return ( | ||
<a href={ this.props.url } onClick={ this.props.onClick } title={ this.props.tooltip } className={ itemClasses }> | ||
{ !! this.props.icon && | ||
<Gridicon icon={ this.props.icon } size={ 24 } /> | ||
} | ||
<span className="masterbar__item-content">{ | ||
this.props.children | ||
}</span> | ||
</a> | ||
); | ||
} | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters