mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-07 06:13:40 +00:00
chore(ui): change background color to transparent for avatar with photoUrl (#7527)
Co-authored-by: Nguyen Tri Hieu <nhieu@fossil.com> Co-authored-by: Chris Collins <chriscollins3456@gmail.com>
This commit is contained in:
parent
73a12379ae
commit
a9a80b8c70
@ -7,9 +7,9 @@ import styled from 'styled-components';
|
|||||||
import defaultAvatar from '../../../images/default_avatar.png';
|
import defaultAvatar from '../../../images/default_avatar.png';
|
||||||
import getAvatarColor from './getAvatarColor';
|
import getAvatarColor from './getAvatarColor';
|
||||||
|
|
||||||
const AvatarStyled = styled(Avatar)<{ size?: number; $backgroundColor: string }>`
|
const AvatarStyled = styled(Avatar)<{ size?: number; $backgroundColor?: string }>`
|
||||||
color: #fff;
|
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;
|
font-size: ${(props) => (props.size ? `${Math.max(props.size / 2.0, 12)}px` : '14px')} !important;
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
@ -61,11 +61,7 @@ export default function CustomAvatar({
|
|||||||
avatarWithInitial
|
avatarWithInitial
|
||||||
);
|
);
|
||||||
const avatar =
|
const avatar =
|
||||||
photoUrl && photoUrl !== '' ? (
|
photoUrl && photoUrl !== '' ? <AvatarStyled src={photoUrl} style={style} size={size} /> : avatarWithDefault;
|
||||||
<AvatarStyled src={photoUrl} style={style} size={size} $backgroundColor={getAvatarColor(name)} />
|
|
||||||
) : (
|
|
||||||
avatarWithDefault
|
|
||||||
);
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
return url ? <Link to={url}>{avatar}</Link> : avatar;
|
return url ? <Link to={url}>{avatar}</Link> : avatar;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user