import { useHovering } from '../hooks/useHovering'; import { autoPlayGif } from '../initial_state'; import type { Account } from '../types/resources'; interface Props { account: Account | undefined; // FIXME: remove `undefined` once we know for sure its always there friend: Account | undefined; // FIXME: remove `undefined` once we know for sure its always there size?: number; baseSize?: number; overlaySize?: number; } export const AvatarOverlay: React.FC = ({ account, friend, size = 46, baseSize = 36, overlaySize = 24, }) => { const { hovering, handleMouseEnter, handleMouseLeave } = useHovering(autoPlayGif); const accountSrc = hovering ? account?.get('avatar') : account?.get('avatar_static'); const friendSrc = hovering ? friend?.get('avatar') : friend?.get('avatar_static'); return (
{accountSrc && {account?.get('acct')}}
{friendSrc && {friend?.get('acct')}}
); };