Skip to content

Commit fcdaaae

Browse files
committed
Merge branch 'master' into remove-immutable
2 parents 26f29d8 + e99fdb3 commit fcdaaae

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

src/components/ChannelHeader/ChannelHeader.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
// @ts-check
21
import React, { useContext } from 'react';
32
import PropTypes from 'prop-types';
43
import { Avatar as DefaultAvatar } from '../Avatar';
5-
import { ChannelContext, TranslationContext, ChatContext } from '../../context';
4+
import { ChannelContext, ChatContext, TranslationContext } from '../../context';
65

76
/**
87
* ChannelHeader - Render some basic information about this channel
98
* @example ../../docs/ChannelHeader.md
109
* @type {React.FC<import('types').ChannelHeaderProps>}
1110
*/
12-
const ChannelHeader = ({ Avatar = DefaultAvatar, title, live }) => {
13-
/** @type {import("types").TranslationContextValue} */
14-
const { t } = useContext(TranslationContext);
15-
/** @type {import("types").ChannelContextValue} */
11+
const ChannelHeader = (props) => {
12+
const { Avatar = DefaultAvatar, image: propImage, live, title } = props;
13+
1614
const { channel, watcher_count } = useContext(ChannelContext);
1715
const { openMobileNav } = useContext(ChatContext);
18-
const { image, member_count, name, subtitle } = channel?.data || {};
16+
const { t } = useContext(TranslationContext);
17+
18+
const { image: channelImage, member_count, name, subtitle } =
19+
channel?.data || {};
20+
21+
const image = propImage || channelImage;
1922

2023
return (
2124
<div className="str-chat__header-livestream">
@@ -68,10 +71,12 @@ ChannelHeader.propTypes = {
6871
* Defaults to and accepts same props as: [Avatar](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Avatar/Avatar.js)
6972
* */
7073
Avatar: /** @type {PropTypes.Validator<React.ElementType<import('types').AvatarProps>>} */ (PropTypes.elementType),
71-
/** Set title manually */
72-
title: PropTypes.string,
74+
/** Manually set the image to render, defaults to the channel image */
75+
image: PropTypes.string,
7376
/** Show a little indicator that the channel is live right now */
7477
live: PropTypes.bool,
78+
/** Set title manually */
79+
title: PropTypes.string,
7580
};
7681

7782
export default React.memo(ChannelHeader);

src/styles/ChannelHeader.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@
274274

275275
.str-chat__header-hamburger {
276276
width: 30px;
277-
height: 40px;
277+
height: 38px;
278278
padding: 10px 10px 10px 0px;
279279
margin-right: 10px;
280280
display: none;

types/index.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,10 +666,11 @@ export interface MessageListProps {
666666

667667
export interface ChannelHeaderProps {
668668
Avatar?: React.ElementType<AvatarProps>;
669-
/** Set title manually */
670-
title?: string;
669+
image?: string;
671670
/** Show a little indicator that the channel is live right now */
672671
live?: boolean;
672+
/** Set title manually */
673+
title?: string;
673674
}
674675

675676
export interface MessageInputProps {

0 commit comments

Comments
 (0)