Refactored header rendering.

This commit is contained in:
Sean Li 2015-06-04 13:54:23 -07:00
parent bb98625da0
commit 600c258d65
1 changed files with 30 additions and 10 deletions

View File

@ -115,9 +115,12 @@ var Header = React.createClass({
} }
return buttons; return buttons;
}, },
render: function () { renderDashboardHeader: function () {
let updateWidget = this.state.updateAvailable && !this.props.hideLogin ? <a className="btn btn-action small no-drag" onClick={this.handleAutoUpdateClick}>UPDATE NOW</a> : null; let headerClasses = classNames({
bordered: !this.props.hideLogin,
header: true,
'no-drag': true
});
let username; let username;
if (this.props.hideLogin) { if (this.props.hideLogin) {
username = null; username = null;
@ -134,13 +137,7 @@ var Header = React.createClass({
</span> </span>
); );
} }
let updateWidget = this.state.updateAvailable && !this.props.hideLogin ? <a className="btn btn-action small no-drag" onClick={this.handleAutoUpdateClick}>UPDATE NOW</a> : null;
let headerClasses = classNames({
bordered: !this.props.hideLogin,
header: true,
'no-drag': true
});
return ( return (
<div className={headerClasses}> <div className={headerClasses}>
<div className="left-header"> <div className="left-header">
@ -158,6 +155,29 @@ var Header = React.createClass({
</div> </div>
</div> </div>
); );
},
renderBasicHeader: function () {
let headerClasses = classNames({
bordered: !this.props.hideLogin,
header: true,
'no-drag': true
});
return (
<div className={headerClasses}>
<div className="left-header">
{this.renderWindowButtons()}
</div>
<div className="right-header">
</div>
</div>
);
},
render: function () {
if (this.props.hideLogin) {
return this.renderBasicHeader();
} else {
return this.renderDashboardHeader();
}
} }
}); });