Skip to content

Commit c4b78b9

Browse files
committed
Fix login menu
1 parent f905626 commit c4b78b9

File tree

2 files changed

+23
-38
lines changed

2 files changed

+23
-38
lines changed

packages/client/src/components/MainNavigation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ function MainNavigation() {
3939
return (
4040
<Flex as='nav' aria-label='Main' gap={4} alignItems='center'>
4141
<List display='flex' gap={2}>
42-
<NavItem to='/collections/' leftIcon={<CollecticonFolder />}>
42+
<NavItem to='/collections/' rightIcon={<CollecticonFolder />}>
4343
Browse
4444
</NavItem>
4545
{keycloak?.authenticated && (
46-
<NavItem to='/collections/new' leftIcon={<CollecticonPlusSmall />}>
46+
<NavItem to='/collections/new' rightIcon={<CollecticonPlusSmall />}>
4747
Create
4848
</NavItem>
4949
)}
Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
import {
2-
Avatar,
3-
Box,
4-
Menu,
5-
MenuButton,
6-
MenuGroup,
7-
MenuItem,
8-
MenuList
9-
} from '@chakra-ui/react';
101
import React, { useEffect, useState } from 'react';
2+
import { Avatar, Button } from '@chakra-ui/react';
3+
import {
4+
CollecticonLogin,
5+
CollecticonLogout
6+
} from '@devseed-ui/collecticons-chakra';
7+
118
import { useKeycloak } from 'src/auth/Context';
129

1310
async function hash(string: string) {
@@ -38,54 +35,42 @@ export function UserInfo() {
3835

3936
if (!isAuthenticated || !profile || isLoading) {
4037
return (
41-
<Box
42-
as='button'
38+
<Button
39+
variant='outline'
40+
rightIcon={<CollecticonLogin />}
4341
onClick={() => {
4442
if (!isLoading) {
4543
keycloak.login({
4644
redirectUri: window.location.href
4745
});
4846
}
4947
}}
50-
_hover={{ opacity: 0.8 }}
51-
transition='opacity 0.32s'
5248
>
53-
<Avatar size='sm' />
54-
</Box>
49+
Login
50+
</Button>
5551
);
5652
}
5753

5854
const username =
5955
`${profile.firstName} ${profile.lastName}`.trim() || profile.username;
6056

6157
return (
62-
<Menu>
63-
<Box as={MenuButton} _hover={{ opacity: 0.8 }} transition='opacity 0.32s'>
58+
<Button
59+
variant='outline'
60+
rightIcon={<CollecticonLogout />}
61+
leftIcon={
6462
<Avatar
6563
size='sm'
6664
name={username}
6765
bg='secondary.500'
6866
color='white'
69-
borderRadius='md'
67+
borderRadius='4px'
7068
src={`https://www.gravatar.com/avatar/${userEmailHash}?d=404`}
7169
/>
72-
</Box>
73-
<MenuList>
74-
<MenuGroup title='Account'>
75-
<MenuItem
76-
color='danger.500'
77-
_hover={{ bg: 'danger.200' }}
78-
_focus={{ bg: 'danger.200' }}
79-
onClick={() => {
80-
keycloak.logout({
81-
redirectUri: window.location.origin
82-
});
83-
}}
84-
>
85-
Log Out
86-
</MenuItem>
87-
</MenuGroup>
88-
</MenuList>
89-
</Menu>
70+
}
71+
pl='2px'
72+
>
73+
Logout
74+
</Button>
9075
);
9176
}

0 commit comments

Comments
 (0)