-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: improvements in profiling, authentication and refactoring
- Loading branch information
Showing
5 changed files
with
112 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import React from 'react'; | ||
import { NavLink, useNavigate } from 'react-router-dom'; | ||
import { | ||
Box, | ||
Button, | ||
useColorModeValue, | ||
Menu, | ||
MenuButton, | ||
MenuList, | ||
MenuItem, | ||
MenuGroup, | ||
MenuDivider, | ||
Image, | ||
} from '@chakra-ui/react'; | ||
import { FaRegUserCircle } from 'react-icons/fa'; | ||
import { FaPowerOff } from 'react-icons/fa6'; | ||
import { logOut } from '../../../services/firebase/auth'; | ||
|
||
interface MenuType { | ||
displayName: string | null; | ||
photoURL: string | null; | ||
uid: string; | ||
} | ||
|
||
export function MenuProfile({ displayName, photoURL, uid }: MenuType) { | ||
const navigate = useNavigate(); | ||
const colorBorder = useColorModeValue('black', 'white'); | ||
|
||
return ( | ||
<Menu isLazy> | ||
<Button background='none' p='0' _hover={{ background: 'none' }} ml='4'> | ||
<MenuButton | ||
as={Box} | ||
borderRadius='full' | ||
_hover={{ border: `2px solid ${colorBorder}` }} | ||
> | ||
<Image | ||
src={photoURL as string} | ||
w='35px' | ||
h='35px' | ||
borderRadius='full' | ||
/> | ||
</MenuButton> | ||
</Button> | ||
<MenuList> | ||
<MenuGroup | ||
title={displayName as string} | ||
fontSize='md' | ||
textAlign='center' | ||
> | ||
<MenuItem | ||
as={NavLink} | ||
to={`/profile/${uid}`} | ||
icon={<FaRegUserCircle size='15px' />} | ||
_hover={{ textDecoration: 'none' }} | ||
> | ||
Perfil | ||
</MenuItem> | ||
</MenuGroup> | ||
<MenuDivider /> | ||
<MenuGroup> | ||
<MenuItem | ||
as={Button} | ||
fontSize='md' | ||
m='0' | ||
fontWeight='normal' | ||
borderRadius='0' | ||
justifyContent='left' | ||
icon={<FaPowerOff size='15px' />} | ||
onClick={() => { | ||
logOut(); | ||
navigate('/', { replace: true }); | ||
}} | ||
> | ||
Cerrar Sessión | ||
</MenuItem> | ||
</MenuGroup> | ||
</MenuList> | ||
</Menu> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d9f7d5c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
xbu – ./
xbu.vercel.app
xbu-git-main-franqsanz.vercel.app
xbu-franqsanz.vercel.app