diff --git a/src/components/views/avatars/BaseAvatar.tsx b/src/components/views/avatars/BaseAvatar.tsx index 963c867f4d0..92c469a0bff 100644 --- a/src/components/views/avatars/BaseAvatar.tsx +++ b/src/components/views/avatars/BaseAvatar.tsx @@ -139,35 +139,7 @@ const BaseAvatar: React.FC = (props) => { const [imageUrl, onError] = useImageUrl({ url, urls }); if (!imageUrl && defaultToInitialLetter && name) { - const initialLetter = AvatarLogic.getInitialLetter(name); - const textNode = ( - - ); - const imgNode = ( - - ); + const avatar = ; if (onClick) { return ( @@ -180,8 +152,7 @@ const BaseAvatar: React.FC = (props) => { onClick={onClick} inputRef={inputRef} > - {textNode} - {imgNode} + {avatar} ); } else { @@ -192,8 +163,7 @@ const BaseAvatar: React.FC = (props) => { {...otherProps} role="presentation" > - {textNode} - {imgNode} + {avatar} ); } @@ -240,3 +210,47 @@ const BaseAvatar: React.FC = (props) => { export default BaseAvatar; export type BaseAvatarType = React.FC; + +const TextAvatar: React.FC<{ + name: string; + idName?: string; + width: number; + height: number; + title?: string; +}> = ({ name, idName, width, height, title }) => { + const initialLetter = AvatarLogic.getInitialLetter(name); + const textNode = ( + + ); + const imgNode = ( + + ); + + return ( + <> + {textNode} + {imgNode} + + ); +};