-
Notifications
You must be signed in to change notification settings - Fork 2
Added nonfunctional profile picture edit and delete icons #265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ddca38a
Added profile picture edit and delete icons
sirQuail 026cbf0
Implemented copilot suggestions
sirQuail cec6faa
removed unused onHover line
sirQuail 51d1b8c
Removed redundant ProfileSidebar file.
sirQuail af02c39
Resolved an issue where I added an older file:
sirQuail b05c36b
Implemented suggestions from zalexa19 code review
sirQuail File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
88 changes: 88 additions & 0 deletions
88
client/src/features/trainee-profile/profile/components/ProfilePictureModal.tsx
This file contains hidden or 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,88 @@ | ||
| import { Avatar, Box, Fade, IconButton } from '@mui/material'; | ||
| import React from 'react'; | ||
| import EditIcon from '@mui/icons-material/Edit'; | ||
| import DeleteIcon from '@mui/icons-material/Delete'; | ||
|
|
||
| interface ProfilePictureModalProps { | ||
| imageUrl?: string | undefined; | ||
| displayName?: string | undefined; | ||
| onUploadModalOpen: () => void; | ||
| onConfirmationDialogOpen: () => void; | ||
| } | ||
|
|
||
| export const ProfilePictureModal = ({ | ||
| imageUrl, | ||
| displayName, | ||
| onUploadModalOpen, | ||
| onConfirmationDialogOpen, | ||
| }: ProfilePictureModalProps) => { | ||
| const [isHovering, setIsHovering] = React.useState<boolean>(false); | ||
|
|
||
| return ( | ||
| <Box | ||
| onMouseEnter={() => { | ||
| setIsHovering(true); | ||
| }} | ||
| onMouseLeave={() => { | ||
| setIsHovering(false); | ||
| }} | ||
| height={180} | ||
| width={180} | ||
| display="flex" | ||
| justifyContent="center" | ||
| position="relative" | ||
| > | ||
| <Avatar | ||
| src={imageUrl} | ||
| alt={displayName} | ||
| variant="square" | ||
| sx={{ | ||
| width: '100%', | ||
| height: '100%', | ||
| filter: isHovering ? 'brightness(0.7)' : 'none', | ||
| }} | ||
| /> | ||
|
|
||
| {isHovering && ( | ||
| <Box | ||
| sx={{ | ||
| display: 'flex', | ||
| position: 'absolute', | ||
| justifyContent: 'center', | ||
| alignItems: 'center', | ||
| gap: 5, | ||
| top: 0, | ||
| bottom: 0, | ||
| left: 0, | ||
| right: 0, | ||
| }} | ||
| > | ||
| <Fade in={isHovering}> | ||
| <IconButton onClick={onUploadModalOpen} aria-label="Edit profile picture"> | ||
| <EditIcon | ||
| sx={{ | ||
| color: 'white', | ||
| fontSize: 40, | ||
| '&:hover': { transform: 'scale(1.1)' }, | ||
| '&:active': { transform: 'scale(0.9)' }, | ||
| }} | ||
| /> | ||
| </IconButton> | ||
| </Fade> | ||
| <Fade in={isHovering}> | ||
| <IconButton onClick={onConfirmationDialogOpen} aria-label="Delete profile picture"> | ||
| <DeleteIcon | ||
| sx={{ | ||
| color: 'white', | ||
| fontSize: 40, | ||
| '&:hover': { transform: 'scale(1.1)' }, | ||
| '&:active': { transform: 'scale(0.9)' }, | ||
| }} | ||
| /> | ||
| </IconButton> | ||
| </Fade> | ||
| </Box> | ||
| )} | ||
| </Box> | ||
| ); | ||
| }; |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.