Skip to content

Commit

Permalink
chore(ui): change background color to transparent for avatar with pho…
Browse files Browse the repository at this point in the history
…toUrl
  • Loading branch information
Nguyen Tri Hieu committed Mar 23, 2023
1 parent 6a4c061 commit 4058533
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions datahub-web-react/src/app/shared/avatar/CustomAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import styled from 'styled-components';
import defaultAvatar from '../../../images/default_avatar.png';
import getAvatarColor from './getAvatarColor';

const AvatarStyled = styled(Avatar)<{ size?: number; $backgroundColor: string }>`
const AvatarStyled = styled(Avatar)<{ size?: number; $backgroundColor?: string }>`
color: #fff;
background-color: ${(props) => props.$backgroundColor};
background-color: ${(props) => (props.$backgroundColor ? `${props.$backgroundColor}` : 'transparent')};
font-size: ${(props) => (props.size ? `${Math.max(props.size / 2.0, 12)}px` : '14px')} !important;
margin-right: 4px;
height: 24px;
Expand Down Expand Up @@ -61,11 +61,7 @@ export default function CustomAvatar({
avatarWithInitial
);
const avatar =
photoUrl && photoUrl !== '' ? (
<AvatarStyled src={photoUrl} style={style} size={size} $backgroundColor={getAvatarColor(name)} />
) : (
avatarWithDefault
);
photoUrl && photoUrl !== '' ? <AvatarStyled src={photoUrl} style={style} size={size} /> : avatarWithDefault;
if (!name) {
return url ? <Link to={url}>{avatar}</Link> : avatar;
}
Expand Down

0 comments on commit 4058533

Please sign in to comment.