mirror of
				https://github.com/datahub-project/datahub.git
				synced 2025-11-04 04:39:10 +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 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;
 | 
			
		||||
@ -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;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user