Skip to content

Commit

Permalink
fix: Remove log out button and show role placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
o-jorgensen committed Jan 9, 2025
1 parent 429cae7 commit 794978f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
25 changes: 25 additions & 0 deletions src/features/AppBar/Icons/Icons.styled.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
import styled from 'styled-components';
import { spacings } from '../../../tokens/spacings';
import { theme } from '../../../tokens/theme';

export const Icons = styled.div`
display: flex;
gap: ${spacings.SMALL};
/* Remove interaction hints since this is no longer a menu */
.menu-item:hover {
background: white;
cursor: default;
}
.user-info {
display: flex;
flex-direction: column;
row-gap: ${spacings.X_SMALL};
list-style: none;
line-height: 1.5;
margin: 0;
padding: 0;
.name {
font-weight: 700;
}
.role {
color: ${theme.light.text.staticIconsTertiary};
}
}
`;
15 changes: 8 additions & 7 deletions src/features/AppBar/Icons/Icons.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useMsal } from '@azure/msal-react';
import { Button, Menu } from '@equinor/eds-core-react';
import { Menu } from '@equinor/eds-core-react';
import { account_circle as accountCircle } from '@equinor/eds-icons';
import MenuIcon from '../../../components/MenuIcon/MenuIcon';
import * as Styled from './Icons.styled';
Expand All @@ -17,12 +17,13 @@ export const Icons = () => {
return (
<Styled.Icons>
<MenuIcon icon={icons.userInfo}>
<Menu.Section title="Logged in">
<Menu.Item>{instance.getActiveAccount()?.name}</Menu.Item>
<Menu.Item as={'div'}>
<Button onClick={() => instance.logoutRedirect()}>Log out</Button>
</Menu.Item>
</Menu.Section>
<Menu.Item as={'div'} className="menu-item">
<ul className="user-info">
<li className="name">{instance.getActiveAccount()?.name}</li>
<li className="role">[Admin|User|Reader] role</li>
{/* TODO add proper role name */}
</ul>
</Menu.Item>
</MenuIcon>
</Styled.Icons>
);
Expand Down

0 comments on commit 794978f

Please sign in to comment.