You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailchat/client/web/src/components/UserAvatar.tsx

24 lines
527 B
TypeScript

import React from 'react';
import { Avatar } from 'tailchat-design';
import { useCachedUserInfo } from 'tailchat-shared';
/**
* 用户头像组件
*/
export const UserAvatar: React.FC<{
userId: string;
className?: string;
}> = React.memo((props) => {
const { userId, className } = props;
const cachedUserInfo = useCachedUserInfo(userId);
return (
<Avatar
className={className}
src={cachedUserInfo.avatar}
name={cachedUserInfo.nickname}
/>
);
});
UserAvatar.displayName = 'UserAvatar';