diff --git a/src/app/App.js b/src/app/App.js index 53be89a14..094f60d20 100644 --- a/src/app/App.js +++ b/src/app/App.js @@ -63,12 +63,14 @@ type Props = { type State = { displaySideMenu: boolean, loggedIn: boolean, + displayUserGroups: boolean, }; class App extends Component { state = { displaySideMenu: false, loggedIn: false, + displayUserGroups: false, } timerID: any @@ -164,6 +166,12 @@ class App extends Component { }); }; + toggleDisplayUserGroups = () => { + this.setState({ + displayUserGroups: !this.state.displayUserGroups, + }); + } + handleDismissErrorModal = () => { this.props.closeReveal('apiError'); this.props.clearError(); @@ -183,7 +191,7 @@ class App extends Component { userActiveServiceUnit, userServiceUnits, } = this.props; - const {displaySideMenu} = this.state; + const {displaySideMenu, displayUserGroups} = this.state; const appStyle = (IS_DEVELOPMENT_URL) ? 'app-dev' : 'app'; if (isEmpty(user) || isEmpty(apiToken)) { @@ -272,11 +280,25 @@ class App extends Component { pageTitle={pageTitle} showSearch={showSearch} toggleSideMenu={this.toggleSideMenu} - userGroups={userGroups} + toggleDisplayUserGroups={this.toggleDisplayUserGroups} username={get(user, 'profile.name')} userServiceUnits={userServiceUnits} userActiveServiceUnit={userActiveServiceUnit} /> + {displayUserGroups && +
+ Käyttäjäryhmät ja palvelukokonaisuudet + {userGroups && userGroups.length > 1 && + userGroups.map((group, index) => { + return ( +

+ {group} +

+ ); + })} +
+ } +
{ userActiveServiceUnit, userServiceUnits, username, + toggleDisplayUserGroups } = this.props; const {search} = this.state; @@ -207,7 +209,7 @@ class TopNavigation extends Component {

- {username}{!!userGroups && !!userGroups.length && ` (${userGroups.join(', ')})`} + {username}

diff --git a/src/components/topNavigation/_top-navigation.scss b/src/components/topNavigation/_top-navigation.scss index 239778c14..3aea44cd0 100644 --- a/src/components/topNavigation/_top-navigation.scss +++ b/src/components/topNavigation/_top-navigation.scss @@ -74,33 +74,7 @@ &__right-wrapper { display: flex; align-items: center; - - .user-icon-wrapper { - position: relative; - line-height: 1; - - .userIcon { - margin: 0; - width: 30px; - height: 30px; - } - - .badge { - position: absolute; - font-family: $font-family-source; - font-size: rem-calc(12px); - min-width: rem-calc(20px); - padding: rem-calc(4px); - color: $white; - font-weight: 600; - text-align: center; - border-radius: 50%; - background-color: $red; - top: rem-calc(-3px); - right: rem-calc(-10px); - } - } - + .username-wrapper { line-height: 1; margin-left: 20px; @@ -111,6 +85,10 @@ margin: 0; font-weight: 500; font-size: rem-calc(16px); + + .user-group-icon g { + fill: #0078C0; + } } .logout-link { @@ -179,4 +157,6 @@ font-weight: 500; } } + + }