Skip to content

Commit

Permalink
Support User: Highlight Masterbar when active
Browse files Browse the repository at this point in the history
  • Loading branch information
jordwest committed Feb 2, 2016
1 parent 9932ff0 commit adea312
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
5 changes: 4 additions & 1 deletion client/layout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ Layout = React.createClass( {
<MasterbarLoggedIn
user={ this.props.user }
section={ this.props.section }
sites={ this.props.sites } />
sites={ this.props.sites }
isSupportUser={ config.isEnabled( 'support-user' ) && this.props.isSupportUser } />
);
},

Expand Down Expand Up @@ -143,8 +144,10 @@ Layout = React.createClass( {
export default connect(
( state ) => {
const { isLoading, section, hasSidebar, chunkName } = state.ui;
const isSupportUser = state.support.isSupportUser;
return {
isLoading,
isSupportUser,
section,
hasSidebar,
chunkName,
Expand Down
2 changes: 1 addition & 1 deletion client/layout/masterbar/logged-in.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default React.createClass( {

render() {
return (
<Masterbar>
<Masterbar className={ this.props.isSupportUser ? 'masterbar__support-user' : null }>
<Stats
icon={ this.wordpressIcon() }
onClick={ this.clickMySites }
Expand Down
5 changes: 3 additions & 2 deletions client/layout/masterbar/masterbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
* External dependencies
*/
import React from 'react';
import classNames from 'classnames';

const Masterbar = ( { children } ) => (
<header id="header" className="masterbar">
const Masterbar = ( { children, className } ) => (
<header id="header" className={ classNames( 'masterbar', className ) }>
{ children }
</header>
);
Expand Down
8 changes: 8 additions & 0 deletions client/layout/masterbar/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ $autobar-height: 20px;
}
}

.masterbar__support-user {
background-color: $orange-jazzy;

.masterbar__item.is-active {
background-color: darken( $orange-jazzy, 10% );
}
}

@keyframes bubble-unread-indication {
30% {
transform: scale(1.5);
Expand Down
11 changes: 11 additions & 0 deletions client/state/support/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ import {
SUPPORT_USER_RESTORE,
} from 'state/action-types';

export function isSupportUser( state = false, action ) {
switch ( action.type ) {
case SUPPORT_USER_TOKEN_SET:
return !! ( action.supportUser && action.supportToken );
case SUPPORT_USER_RESTORE:
return false;
}
return state;
}

export function supportUser( state = '', action ) {
switch ( action.type ) {
case SUPPORT_USER_TOKEN_SET:
Expand All @@ -30,6 +40,7 @@ export function supportToken( state = '', action ) {
}

export default combineReducers( {
isSupportUser,
supportUser,
supportToken,
} );

0 comments on commit adea312

Please sign in to comment.