diff --git a/src/app/components/avatar-decoration/AvatarDecoration.tsx b/src/app/components/avatar-decoration/AvatarDecoration.tsx index ea32df1ed..9f510e9ae 100644 --- a/src/app/components/avatar-decoration/AvatarDecoration.tsx +++ b/src/app/components/avatar-decoration/AvatarDecoration.tsx @@ -2,17 +2,15 @@ import React from 'react'; import { useAvatarDecoration } from '../../hooks/useAvatarDecoration'; import { decorationUrl } from '../../features/lotus/avatarDecorations'; -// How far the decoration image extends beyond the avatar on each side (px). -// The APNG files are 256×256 with a transparent center. At this extension -// the center hole lines up naturally with the avatar beneath it. -const INSET = 8; +const DEFAULT_INSET = 8; type AvatarDecorationProps = { userId: string; children: React.ReactNode; + inset?: number; }; -export function AvatarDecoration({ userId, children }: AvatarDecorationProps) { +export function AvatarDecoration({ userId, children, inset = DEFAULT_INSET }: AvatarDecorationProps) { const slug = useAvatarDecoration(userId); if (!slug) { @@ -32,12 +30,12 @@ export function AvatarDecoration({ userId, children }: AvatarDecorationProps) { src={decorationUrl(slug)} style={{ position: 'absolute', - top: -INSET, - left: -INSET, - right: -INSET, - bottom: -INSET, - width: `calc(100% + ${INSET * 2}px)`, - height: `calc(100% + ${INSET * 2}px)`, + top: -inset, + left: -inset, + right: -inset, + bottom: -inset, + width: `calc(100% + ${inset * 2}px)`, + height: `calc(100% + ${inset * 2}px)`, pointerEvents: 'none', zIndex: 10, objectFit: 'contain', diff --git a/src/app/components/user-profile/UserHero.tsx b/src/app/components/user-profile/UserHero.tsx index dd10a7aeb..594e4aae9 100644 --- a/src/app/components/user-profile/UserHero.tsx +++ b/src/app/components/user-profile/UserHero.tsx @@ -19,6 +19,7 @@ import { getMxIdLocalPart } from '../../utils/matrix'; import { BreakWord, LineClamp2, LineClamp3 } from '../../styles/Text.css'; import { UserPresence } from '../../hooks/useUserPresence'; import { AvatarPresence, PresenceBadge } from '../presence'; +import { AvatarDecoration } from '../avatar-decoration/AvatarDecoration'; import { ImageViewer } from '../image-viewer'; import { stopPropagation } from '../../utils/keyboard'; import { useSetting } from '../../state/hooks/settings'; @@ -47,27 +48,29 @@ export function UserHero({ userId, avatarUrl, presence }: UserHeroProps) { )}
- - } - > - setViewAvatar(avatarUrl) : undefined} - className={css.UserHeroAvatar} - size="500" + + + } > - } - /> - - + setViewAvatar(avatarUrl) : undefined} + className={css.UserHeroAvatar} + size="500" + > + } + /> + + + {viewAvatar && ( }>