refactor(frontend): extract avatar image component

This commit is contained in:
sam 2024-10-01 14:44:34 +02:00
parent 562ecc46bd
commit b1165c3780
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
3 changed files with 31 additions and 13 deletions

View file

@ -6,6 +6,7 @@ import ProfileLink from "~/components/profile/ProfileLink";
import ProfileField from "~/components/profile/ProfileField";
import { useTranslation } from "react-i18next";
import { renderMarkdown } from "~/lib/markdown";
import AvatarImage from "~/components/profile/AvatarImage";
export type Props = {
name: string;
@ -31,20 +32,16 @@ export default function BaseProfile({
<div className="row">
<div className="col-md-4 text-center">
{userI18nKeys ? (
<img
<AvatarImage
src={profile.avatar_url || defaultAvatarUrl}
alt={t("user.avatar-alt", { username: name })}
width={200}
height={200}
className="rounded-circle img-fluid"
alt={t("user.avatar-alt", { username: name })}
/>
) : (
<img
<AvatarImage
src={profile.avatar_url || defaultAvatarUrl}
alt={t("member.avatar-alt", { name: name })}
width={200}
height={200}
className="rounded-circle img-fluid"
alt={t("member.avatar-alt", { name: name })}
/>
)}
{profile.flags && profile.bio && (