fix: 802 if no text dont show avatar (#831)

* fix: 802 if no text dont show avatar

* fix: 802 use guard for empty check and allow whitespace only case
This commit is contained in:
310387 2023-07-23 02:28:33 +03:00 committed by GitHub
parent 7f6b39339b
commit c4468d60f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ import { Theme } from '@emotion/react';
import styled from '@emotion/styled';
import { Avatar, AvatarType } from '@/users/components/Avatar';
import { isNonEmptyString } from '~/utils/isNonEmptyString';
import { OverflowingTextWithTooltip } from '../../tooltip/OverflowingTextWithTooltip';
@ -89,6 +90,7 @@ export function EntityChip({
onClick={handleLinkClick}
variant={variant}
>
{isNonEmptyString(name) && (
<Avatar
avatarUrl={picture}
colorId={entityId}
@ -96,12 +98,14 @@ export function EntityChip({
size={14}
type={avatarType}
/>
)}
<StyledName>
<OverflowingTextWithTooltip text={name} />
</StyledName>
</StyledContainerLink>
) : (
<StyledContainerReadOnly data-testid="entity-chip">
{isNonEmptyString(name) && (
<Avatar
avatarUrl={picture}
colorId={entityId}
@ -109,6 +113,7 @@ export function EntityChip({
size={14}
type={avatarType}
/>
)}
<StyledName>
<OverflowingTextWithTooltip text={name} />
</StyledName>