Skip to content

Commit 01dc564

Browse files
committed
feat: add UserTableAvatarInfo component and update imports
Signed-off-by: Amit Amrutiya <amitamrutiya2210@gmail.com>
1 parent 92bcc03 commit 01dc564

3 files changed

Lines changed: 52 additions & 2 deletions

File tree

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { Avatar, Box, Grid, Typography } from '../../base';
2+
import { CLOUD_URL } from '../../constants/constants';
3+
import { PersonIcon } from '../../icons';
4+
import { useTheme } from '../../theme';
5+
6+
interface UserTableAvatarInfoProps {
7+
userId: string;
8+
userName: string;
9+
userEmail: string;
10+
profileUrl?: string;
11+
}
12+
13+
const UserTableAvatarInfo: React.FC<UserTableAvatarInfoProps> = ({
14+
userId,
15+
userName,
16+
userEmail,
17+
profileUrl
18+
}): JSX.Element => {
19+
const theme = useTheme();
20+
const handleProfileClick = (): void => {
21+
window.open(`${CLOUD_URL}/user/${userId}`);
22+
};
23+
24+
return (
25+
<Grid container alignItems="center">
26+
<Grid item>
27+
<Box
28+
sx={{
29+
color: theme.palette.text.default,
30+
mr: 2,
31+
cursor: 'pointer'
32+
}}
33+
>
34+
<Avatar onClick={handleProfileClick} alt={userName} src={profileUrl}>
35+
{profileUrl ? '' : <PersonIcon />}
36+
</Avatar>
37+
</Box>
38+
</Grid>
39+
<Grid item xs>
40+
{userName}
41+
<Typography variant="body2" color={theme.palette.background.brand?.disabled}>
42+
{userEmail}
43+
</Typography>
44+
</Grid>
45+
</Grid>
46+
);
47+
};
48+
49+
export default UserTableAvatarInfo;

src/custom/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import { TooltipIcon } from './TooltipIconButton';
4747
import { TransferList } from './TransferModal/TransferList';
4848
import { TransferListProps } from './TransferModal/TransferList/TransferList';
4949
import UniversalFilter, { UniversalFilterProps } from './UniversalFilter';
50-
import { UsersTable } from './UsersTable';
50+
import { UserTableAvatarInfo, UsersTable } from './UsersTable';
5151
import { VisibilityChipMenu } from './VisibilityChipMenu';
5252
export { CatalogCard } from './CatalogCard';
5353
export { CatalogFilterSidebar } from './CatalogFilterSection';
@@ -104,6 +104,7 @@ export {
104104
TooltipIcon,
105105
TransferList,
106106
UniversalFilter,
107+
UserTableAvatarInfo,
107108
UsersTable,
108109
VisibilityChipMenu,
109110
updateVisibleColumns,

0 commit comments

Comments
 (0)