The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/components/avatar/BaseAvatar.tsx

18 lines
551 B

import type { AvatarProps } from '@rocket.chat/fuselage';
import { Avatar, Skeleton } from '@rocket.chat/fuselage';
import type { FC } from 'react';
import React, { useState } from 'react';
export type BaseAvatarProps = Omit<AvatarProps, 'is'>;
const BaseAvatar: FC<BaseAvatarProps> = ({ size, ...props }) => {
const [error, setError] = useState<unknown>(false);
if (error) {
return <Skeleton aria-hidden variant='rect' {...props} />;
}
return <Avatar aria-hidden onError={setError} size={size} {...props} />;
};
export default BaseAvatar;