use <img> instead of <div> for avatars

This lets you right click steal them more easily
This commit is contained in:
Kay Faraday 2022-01-13 18:12:23 +00:00
parent e8cfabcf92
commit a34b7d3b5e
3 changed files with 11 additions and 11 deletions

View File

@ -57,14 +57,14 @@ export default class Avatar extends React.PureComponent {
backgroundSize: `${size}px ${size}px`,
};
let imageSrc = staticSrc;
if (hovering || animate) {
style.backgroundImage = `url(${src})`;
} else {
style.backgroundImage = `url(${staticSrc})`;
imageSrc = src;
}
return (
<div
<img
src={imageSrc}
className={computedClass}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}

View File

@ -67,6 +67,8 @@ export default class AvatarComposite extends React.PureComponent {
}
}
const imageSrc = account.get(animate ? 'avatar' : 'avatar_static');
const style = {
left: left,
top: top,
@ -74,8 +76,6 @@ export default class AvatarComposite extends React.PureComponent {
bottom: bottom,
width: `${width}%`,
height: `${height}%`,
backgroundSize: 'cover',
backgroundImage: `url(${account.get(animate ? 'avatar' : 'avatar_static')})`,
};
return (
@ -86,7 +86,7 @@ export default class AvatarComposite extends React.PureComponent {
title={`@${account.get('acct')}`}
key={account.get('id')}
>
<div style={style} data-avatar-of={`@${account.get('acct')}`} />
<img src={imageSrc} style={style} data-avatar-of={`@${account.get('acct')}`} />
</a>
);
}

View File

@ -53,14 +53,14 @@ export default class Avatar extends React.PureComponent {
backgroundSize: `${size}px ${size}px`,
};
let imageSrc = staticSrc;
if (hovering || animate) {
style.backgroundImage = `url(${src})`;
} else {
style.backgroundImage = `url(${staticSrc})`;
imageSrc = src;
}
return (
<div
<img
src={imageSrc}
className={className}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}