Fixes rendering of about bio

This commit is contained in:
Josh Perez 2021-01-27 19:18:50 -05:00 committed by GitHub
parent 3ee69c211d
commit 1b38db2d79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 82 additions and 12 deletions

View file

@ -64,7 +64,7 @@ storiesOf('Components/ContactListItem', module)
name="Someone 🔥 Somewhere"
phoneNumber="(202) 555-0011"
profileName="🔥Flames🔥"
about="👍 Free to chat"
about="👍 This is my really long status message that I have in order to test line breaking"
avatarPath={gifUrl}
onClick={onClick}
/>

View file

@ -47,6 +47,7 @@ const commonProps = {
onShowSafetyNumber: action('onShowSafetyNumber'),
onShowAllMedia: action('onShowAllMedia'),
onShowContactModal: action('onShowContactModal'),
onShowGroupMembers: action('onShowGroupMembers'),
onGoBack: action('onGoBack'),

View file

@ -63,6 +63,7 @@ export type PropsDataType = {
export type PropsActionsType = {
onSetMuteNotifications: (seconds: number) => void;
onSetDisappearingMessages: (seconds: number) => void;
onShowContactModal: (contactId: string) => void;
onDeleteMessages: () => void;
onResetSession: () => void;
onSearchInConversation: () => void;
@ -468,6 +469,42 @@ export class ConversationHeader extends React.Component<PropsType> {
);
}
private renderHeader(): JSX.Element {
const { id, isMe, onShowContactModal, type } = this.props;
if (type === 'group' || isMe) {
return (
<div className="module-conversation-header__title-flex">
{this.renderAvatar()}
{this.renderTitle()}
</div>
);
}
const onContactClick = () => onShowContactModal(id);
const onKeyDown = (e: React.KeyboardEvent): void => {
if (e.key === 'Enter' || e.key === ' ') {
e.stopPropagation();
e.preventDefault();
onShowContactModal(id);
}
};
return (
<div
className="module-conversation-header__title-flex module-conversation-header__title-clickable"
onClick={onContactClick}
onKeyDown={onKeyDown}
role="button"
tabIndex={0}
>
{this.renderAvatar()}
{this.renderTitle()}
</div>
);
}
public render(): JSX.Element {
const { id } = this.props;
const triggerId = `conversation-${id}`;
@ -476,10 +513,7 @@ export class ConversationHeader extends React.Component<PropsType> {
<div className="module-conversation-header">
{this.renderBackButton()}
<div className="module-conversation-header__title-container">
<div className="module-conversation-header__title-flex">
{this.renderAvatar()}
{this.renderTitle()}
</div>
{this.renderHeader()}
</div>
{this.renderExpirationLength()}
{this.renderOutgoingCallButtons()}

View file

@ -191,7 +191,7 @@ export const ConversationHero = ({
/>
)}
</h1>
{about && (
{about && !isMe && (
<div className="module-about__container">
<About text={about} />
</div>