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:
@ -4,6 +4,7 @@ import { Theme } from '@emotion/react';
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import { Avatar, AvatarType } from '@/users/components/Avatar';
|
import { Avatar, AvatarType } from '@/users/components/Avatar';
|
||||||
|
import { isNonEmptyString } from '~/utils/isNonEmptyString';
|
||||||
|
|
||||||
import { OverflowingTextWithTooltip } from '../../tooltip/OverflowingTextWithTooltip';
|
import { OverflowingTextWithTooltip } from '../../tooltip/OverflowingTextWithTooltip';
|
||||||
|
|
||||||
@ -89,26 +90,30 @@ export function EntityChip({
|
|||||||
onClick={handleLinkClick}
|
onClick={handleLinkClick}
|
||||||
variant={variant}
|
variant={variant}
|
||||||
>
|
>
|
||||||
<Avatar
|
{isNonEmptyString(name) && (
|
||||||
avatarUrl={picture}
|
<Avatar
|
||||||
colorId={entityId}
|
avatarUrl={picture}
|
||||||
placeholder={name}
|
colorId={entityId}
|
||||||
size={14}
|
placeholder={name}
|
||||||
type={avatarType}
|
size={14}
|
||||||
/>
|
type={avatarType}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<StyledName>
|
<StyledName>
|
||||||
<OverflowingTextWithTooltip text={name} />
|
<OverflowingTextWithTooltip text={name} />
|
||||||
</StyledName>
|
</StyledName>
|
||||||
</StyledContainerLink>
|
</StyledContainerLink>
|
||||||
) : (
|
) : (
|
||||||
<StyledContainerReadOnly data-testid="entity-chip">
|
<StyledContainerReadOnly data-testid="entity-chip">
|
||||||
<Avatar
|
{isNonEmptyString(name) && (
|
||||||
avatarUrl={picture}
|
<Avatar
|
||||||
colorId={entityId}
|
avatarUrl={picture}
|
||||||
placeholder={name}
|
colorId={entityId}
|
||||||
size={14}
|
placeholder={name}
|
||||||
type={avatarType}
|
size={14}
|
||||||
/>
|
type={avatarType}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<StyledName>
|
<StyledName>
|
||||||
<OverflowingTextWithTooltip text={name} />
|
<OverflowingTextWithTooltip text={name} />
|
||||||
</StyledName>
|
</StyledName>
|
||||||
|
|||||||
Reference in New Issue
Block a user