diff --git a/client/ui/Avatar.jsx b/client/ui/Avatar.jsx deleted file mode 100644 index 619410b..0000000 --- a/client/ui/Avatar.jsx +++ /dev/null @@ -1,15 +0,0 @@ -export default function Avatar({ src, text, icon = 'person', ...props } = {}) { - return ( - src ? - {'(头像)' - - : ( - text ? - { - text.substring(0, 0) - } - - : - ) - ) -} diff --git a/client/ui/Avatar.tsx b/client/ui/Avatar.tsx new file mode 100644 index 0000000..4bdbbb5 --- /dev/null +++ b/client/ui/Avatar.tsx @@ -0,0 +1,25 @@ +interface Args extends React.HTMLAttributes { + src?: string + text?: string + icon?: string + avatarRef?: React.LegacyRef +} + +export default function Avatar({ + src, + text, + icon = 'person', + avatarRef, + ...props +}: Args) { + if (src != null) + return + else if (text != null) + return + { + text.substring(0, 0) + } + + else + return +}