Fix avatar showing av when loading (#247)

Signed-off-by: ajbura <ajbura@gmail.com>
This commit is contained in:
ajbura 2022-02-05 18:19:30 +05:30
parent a842b4c4d9
commit d05a426d00
2 changed files with 10 additions and 1 deletions

View file

@ -21,7 +21,15 @@ function Avatar({
<div className={`avatar-container avatar-container__${size} noselect`}> <div className={`avatar-container avatar-container__${size} noselect`}>
{ {
imageSrc !== null imageSrc !== null
? <img draggable="false" src={imageSrc} onError={(e) => { e.target.src = ImageBrokenSVG; }} alt="avatar" /> ? (
<img
draggable="false"
src={imageSrc}
onLoad={(e) => { e.target.style.backgroundColor = 'transparent'; }}
onError={(e) => { e.target.src = ImageBrokenSVG; }}
alt=""
/>
)
: ( : (
<span <span
style={{ backgroundColor: iconSrc === null ? bgColor : 'transparent' }} style={{ backgroundColor: iconSrc === null ? bgColor : 'transparent' }}

View file

@ -31,6 +31,7 @@
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
border-radius: inherit; border-radius: inherit;
background-color: var(--bg-surface-hover);
} }
.avatar__border { .avatar__border {