Skip to content

Commit

Permalink
feat: add UserTableAvatarInfo component and update imports
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Amrutiya <[email protected]>
  • Loading branch information
amitamrutiya committed Jan 31, 2025
1 parent 92bcc03 commit 01dc564
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions src/custom/UsersTable/UserTableAvatarInfo.tsx
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;
3 changes: 2 additions & 1 deletion src/custom/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { TooltipIcon } from './TooltipIconButton';
import { TransferList } from './TransferModal/TransferList';
import { TransferListProps } from './TransferModal/TransferList/TransferList';
import UniversalFilter, { UniversalFilterProps } from './UniversalFilter';
import { UsersTable } from './UsersTable';
import { UserTableAvatarInfo, UsersTable } from './UsersTable';
import { VisibilityChipMenu } from './VisibilityChipMenu';
export { CatalogCard } from './CatalogCard';
export { CatalogFilterSidebar } from './CatalogFilterSection';
Expand Down Expand Up @@ -104,6 +104,7 @@ export {
TooltipIcon,
TransferList,
UniversalFilter,
UserTableAvatarInfo,
UsersTable,
VisibilityChipMenu,
updateVisibleColumns,
Expand Down

0 comments on commit 01dc564

Please sign in to comment.