Skip to content

Commit e82eabd

Browse files
committed
Update Avatar for more reliable Safari rendering
1 parent 00ea6da commit e82eabd

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/avatar.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ const Avatar = ({
3737
maxWidth: maxWidth,
3838
height: 'auto',
3939
borderRadius: '50%',
40+
overflow: 'hidden',
4041
position: 'relative',
4142
display: 'inline-block',
4243
verticalAlign: 'top',
43-
bg: color,
4444
...sx,
4545
}}
4646
{...props}
@@ -49,16 +49,27 @@ const Avatar = ({
4949
alt={altProp}
5050
src={srcProp}
5151
sx={{
52-
opacity: color && color !== 'transparent' ? 0.25 : 1,
5352
filter:
5453
color && color !== 'transparent'
5554
? 'grayscale(100%) contrast(200%) brightness(100%)'
5655
: 'none',
5756
width: '100%',
58-
borderRadius: '50%',
5957
display: 'block',
6058
}}
6159
/>
60+
{color && color !== 'transparent' && (
61+
<Box
62+
sx={{
63+
position: 'absolute',
64+
top: 0,
65+
bg: color,
66+
width: '100%',
67+
height: '100%',
68+
opacity: 0.75,
69+
pointerEvents: 'none',
70+
}}
71+
/>
72+
)}
6273
</Box>
6374
)
6475
}

0 commit comments

Comments
 (0)