diff options
author | crupest <crupest@outlook.com> | 2023-07-19 18:26:00 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2023-07-19 18:26:00 +0800 |
commit | adc91a81fe53fdbc3d63065baa0b56862c104824 (patch) | |
tree | 6dc610d24c231186b81eb01f3b56f24e6660a1c3 /FrontEnd/src/views/common/user/UserAvatar.tsx | |
parent | d712d3847506c5c2df62f741d9d2cb91e34f6bfd (diff) | |
download | timeline-adc91a81fe53fdbc3d63065baa0b56862c104824.tar.gz timeline-adc91a81fe53fdbc3d63065baa0b56862c104824.tar.bz2 timeline-adc91a81fe53fdbc3d63065baa0b56862c104824.zip |
AppBar done!
Diffstat (limited to 'FrontEnd/src/views/common/user/UserAvatar.tsx')
-rw-r--r-- | FrontEnd/src/views/common/user/UserAvatar.tsx | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/FrontEnd/src/views/common/user/UserAvatar.tsx b/FrontEnd/src/views/common/user/UserAvatar.tsx index fcff8c69..aea7bd48 100644 --- a/FrontEnd/src/views/common/user/UserAvatar.tsx +++ b/FrontEnd/src/views/common/user/UserAvatar.tsx @@ -1,19 +1,22 @@ -import * as React from "react"; +import { Ref, ComponentPropsWithoutRef } from "react"; import { getHttpUserClient } from "@/http/user"; -export interface UserAvatarProps - extends React.ImgHTMLAttributes<HTMLImageElement> { +export interface UserAvatarProps extends ComponentPropsWithoutRef<"img"> { username: string; + imgRef?: Ref<HTMLImageElement> | null; } -const UserAvatar: React.FC<UserAvatarProps> = ({ username, ...otherProps }) => { +export default function UserAvatar({ + username, + imgRef, + ...otherProps +}: UserAvatarProps) { return ( <img + ref={imgRef} src={getHttpUserClient().generateAvatarUrl(username)} {...otherProps} /> ); -}; - -export default UserAvatar; +} |