Skip to content

Commit f7eeec8

Browse files
committed
fix: add size prop to ChannelAvatar component
1 parent 261f8a6 commit f7eeec8

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

package/src/components/ChannelPreview/ChannelAvatar.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ import { GroupAvatar } from '../Avatar/GroupAvatar';
1212

1313
export type ChannelAvatarProps<
1414
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
15-
> = Pick<ChannelPreviewProps<StreamChatGenerics>, 'channel'>;
15+
> = Pick<ChannelPreviewProps<StreamChatGenerics>, 'channel'> & {
16+
/**
17+
* The size of the avatar.
18+
*/
19+
size?: number;
20+
};
1621

1722
/**
1823
* This UI component displays an avatar for a particular channel.
@@ -22,15 +27,17 @@ export const ChannelAvatarWithContext = <
2227
>(
2328
props: ChannelAvatarProps<StreamChatGenerics> & Pick<ChatContextValue, 'ImageComponent'>,
2429
) => {
25-
const { channel, ImageComponent } = props;
30+
const { channel, ImageComponent, size: propSize } = props;
2631
const {
2732
theme: {
2833
channelPreview: {
29-
avatar: { size },
34+
avatar: { size: themeSize },
3035
},
3136
},
3237
} = useTheme();
3338

39+
const size = propSize || themeSize;
40+
3441
const displayAvatar = useChannelPreviewDisplayAvatar(channel);
3542
const displayPresence = useChannelPreviewDisplayPresence(channel);
3643

0 commit comments

Comments
 (0)