Skip to content

Commit 18c4b26

Browse files
author
jaapbakker88
authored
Merge pull request #545 from GetStream/fix/CRS-288-fallback-initials-preview
CRS-288: add first letter of display name to avatar
2 parents 2383096 + 20255b8 commit 18c4b26

File tree

6 files changed

+19
-6
lines changed

6 files changed

+19
-6
lines changed

src/components/ChannelPreview/ChannelPreviewCompact.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ const ChannelPreviewCompact = (props) => {
3737
className={`str-chat__channel-preview-compact ${unreadClass} ${activeClass}`}
3838
>
3939
<div className="str-chat__channel-preview-compact--left">
40-
<Avatar image={props.displayImage} size={20} />
40+
<Avatar
41+
image={props.displayImage}
42+
name={props.displayTitle}
43+
size={20}
44+
/>
4145
</div>
4246
<div className="str-chat__channel-preview-compact--right">
4347
{props.displayTitle}

src/components/ChannelPreview/ChannelPreviewLastMessage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const ChannelPreviewLastMessage = (props) => {
3636
{props.unread >= 1 && (
3737
<div className="str-chat__channel-preview--dot" />
3838
)}
39-
<Avatar image={props.displayImage} />
39+
<Avatar image={props.displayImage} name={props.displayTitle} />
4040
<div className="str-chat__channel-preview-info">
4141
<span className="str-chat__channel-preview-title">
4242
{props.displayTitle}

src/components/ChannelPreview/ChannelPreviewMessenger.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ const ChannelPreviewMessenger = (props) => {
3636
data-testid="channel-preview-button"
3737
>
3838
<div className="str-chat__channel-preview-messenger--left">
39-
{<Avatar image={props.displayImage} size={40} />}
39+
{
40+
<Avatar
41+
image={props.displayImage}
42+
name={props.displayTitle}
43+
size={40}
44+
/>
45+
}
4046
</div>
4147
<div className="str-chat__channel-preview-messenger--right">
4248
<div className="str-chat__channel-preview-messenger--name">

src/components/ChannelPreview/__tests__/__snapshots__/ChannelPreviewCompact.test.js.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ exports[`ChannelPreviewCompact should render correctly 1`] = `
2323
"width": "20px",
2424
}
2525
}
26+
title="Channel name"
2627
>
2728
<img
28-
alt=""
29+
alt="C"
2930
className="str-chat__avatar-image"
3031
data-testid="avatar-img"
3132
onError={[Function]}

src/components/ChannelPreview/__tests__/__snapshots__/ChannelPreviewLastMessage.test.js.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ exports[`ChannelPreviewLastMessage should render correctly 1`] = `
2525
"width": "32px",
2626
}
2727
}
28+
title="Channel name"
2829
>
2930
<img
30-
alt=""
31+
alt="C"
3132
className="str-chat__avatar-image"
3233
data-testid="avatar-img"
3334
onError={[Function]}

src/components/ChannelPreview/__tests__/__snapshots__/ChannelPreviewMessenger.test.js.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ exports[`ChannelPreviewMessenger should render correctly 1`] = `
2323
"width": "40px",
2424
}
2525
}
26+
title="Channel name"
2627
>
2728
<img
28-
alt=""
29+
alt="C"
2930
className="str-chat__avatar-image"
3031
data-testid="avatar-img"
3132
onError={[Function]}

0 commit comments

Comments
 (0)