import Avatar from '@design-system/Avatar';

import { type HeaderAvatarProps } from './types';

const HeaderAvatar = ({ avatar, loading }: HeaderAvatarProps) => {
  if (loading)
    return (
      <Avatar
        loading
        size="small"
      />
    );

  if (!avatar) return null;

  return (
    <Avatar
      size="small"
      {...avatar}
    />
  );
};

export default HeaderAvatar;
