Skip to content

Commit

Permalink
fix: add size prop to ChannelAvatar component
Browse files Browse the repository at this point in the history
  • Loading branch information
khushal87 committed Jan 8, 2025
1 parent 261f8a6 commit f7eeec8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions package/src/components/ChannelPreview/ChannelAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import { GroupAvatar } from '../Avatar/GroupAvatar';

export type ChannelAvatarProps<
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
> = Pick<ChannelPreviewProps<StreamChatGenerics>, 'channel'>;
> = Pick<ChannelPreviewProps<StreamChatGenerics>, 'channel'> & {
/**
* The size of the avatar.
*/
size?: number;
};

/**
* This UI component displays an avatar for a particular channel.
Expand All @@ -22,15 +27,17 @@ export const ChannelAvatarWithContext = <
>(
props: ChannelAvatarProps<StreamChatGenerics> & Pick<ChatContextValue, 'ImageComponent'>,
) => {
const { channel, ImageComponent } = props;
const { channel, ImageComponent, size: propSize } = props;
const {
theme: {
channelPreview: {
avatar: { size },
avatar: { size: themeSize },
},
},
} = useTheme();

const size = propSize || themeSize;

const displayAvatar = useChannelPreviewDisplayAvatar(channel);
const displayPresence = useChannelPreviewDisplayPresence(channel);

Expand Down

0 comments on commit f7eeec8

Please sign in to comment.