v3: added emoji picker, various bug and layout fixes
This commit is contained in:
@@ -6,18 +6,22 @@ interface AvatarProps {
|
||||
username: string;
|
||||
hasAvatar: boolean;
|
||||
size?: number;
|
||||
version?: number;
|
||||
}
|
||||
|
||||
export function Avatar(
|
||||
{ userId, username, hasAvatar, size = 36 }: AvatarProps,
|
||||
{ userId, username, hasAvatar, size = 36, version }: AvatarProps,
|
||||
) {
|
||||
const [imgFailed, setImgFailed] = useState(false);
|
||||
const sizeStyle = { width: size, height: size };
|
||||
|
||||
if (hasAvatar && !imgFailed) {
|
||||
const src = version
|
||||
? `${API_URL}/api/avatars/${userId}?v=${version}`
|
||||
: `${API_URL}/api/avatars/${userId}`;
|
||||
return (
|
||||
<img
|
||||
src={`${API_URL}/api/avatars/${userId}`}
|
||||
src={src}
|
||||
alt={username}
|
||||
title={username}
|
||||
style={sizeStyle}
|
||||
|
||||
Reference in New Issue
Block a user