Skip to content

Commit 239f351

Browse files
authored
Merge branch 'main' into KZN-3415/popover-api
2 parents f0ab4e7 + f0612d7 commit 239f351

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.changeset/empty-spies-wear.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@kaizen/components': patch
3+
---
4+
5+
Avatar will render img only if it is available and loaded successfully

packages/components/src/Avatar/Avatar.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ describe('<Avatar />', () => {
1414
fireEvent.error(screen.getByRole('img'))
1515

1616
expect(screen.getByText('JD')).toBeInTheDocument()
17+
expect(screen.queryByRole('img')).not.toBeInTheDocument()
1718
})
1819

1920
describe('full name provided contains more than two names', () => {

packages/components/src/Avatar/Avatar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,13 @@ export const Avatar = ({
156156
)}
157157
{...restProps}
158158
>
159-
{avatarState !== 'none' && (
159+
{avatarState !== 'none' && avatarState !== 'error' && (
160160
<img
161161
ref={image}
162162
className={classnames(
163163
styles.avatarImage,
164164
isCompany && styles.companyAvatarImage,
165-
(avatarState === 'loading' || avatarState === 'error') && styles.loading,
165+
avatarState === 'loading' && styles.loading,
166166
)}
167167
src={avatarSrc}
168168
onError={onImageFailure}

0 commit comments

Comments
 (0)