generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add UserTableAvatarInfo component and update imports
Signed-off-by: Amit Amrutiya <[email protected]>
- Loading branch information
1 parent
92bcc03
commit 01dc564
Showing
3 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,49 @@ | ||
import { Avatar, Box, Grid, Typography } from '../../base'; | ||
import { CLOUD_URL } from '../../constants/constants'; | ||
import { PersonIcon } from '../../icons'; | ||
import { useTheme } from '../../theme'; | ||
|
||
interface UserTableAvatarInfoProps { | ||
userId: string; | ||
userName: string; | ||
userEmail: string; | ||
profileUrl?: string; | ||
} | ||
|
||
const UserTableAvatarInfo: React.FC<UserTableAvatarInfoProps> = ({ | ||
userId, | ||
userName, | ||
userEmail, | ||
profileUrl | ||
}): JSX.Element => { | ||
const theme = useTheme(); | ||
const handleProfileClick = (): void => { | ||
window.open(`${CLOUD_URL}/user/${userId}`); | ||
}; | ||
|
||
return ( | ||
<Grid container alignItems="center"> | ||
<Grid item> | ||
<Box | ||
sx={{ | ||
color: theme.palette.text.default, | ||
mr: 2, | ||
cursor: 'pointer' | ||
}} | ||
> | ||
<Avatar onClick={handleProfileClick} alt={userName} src={profileUrl}> | ||
{profileUrl ? '' : <PersonIcon />} | ||
</Avatar> | ||
</Box> | ||
</Grid> | ||
<Grid item xs> | ||
{userName} | ||
<Typography variant="body2" color={theme.palette.background.brand?.disabled}> | ||
{userEmail} | ||
</Typography> | ||
</Grid> | ||
</Grid> | ||
); | ||
}; | ||
|
||
export default UserTableAvatarInfo; |
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