Do not nest buttons in the conversation header

This commit is contained in:
Josh Perez 2023-04-24 16:18:00 -04:00 committed by GitHub
parent 781531d8d7
commit d39ef234e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,6 +54,7 @@ export function ConversationDetailsHeader({
let preferredBadge: undefined | BadgeType;
let subtitle: ReactNode;
let hasNestedButton = false;
if (isGroup) {
if (conversation.groupDescription) {
subtitle = (
@ -63,6 +64,7 @@ export function ConversationDetailsHeader({
title={conversation.title}
/>
);
hasNestedButton = true;
} else if (canEdit) {
subtitle = i18n('icu:ConversationDetailsHeader--add-group-description');
} else {
@ -163,6 +165,9 @@ export function ConversationDetailsHeader({
>
{contents}
</button>
{hasNestedButton ? (
<div className={bem('subtitle')}>{subtitle}</div>
) : (
<button
type="button"
onClick={ev => {
@ -178,6 +183,7 @@ export function ConversationDetailsHeader({
>
<div className={bem('subtitle')}>{subtitle}</div>
</button>
)}
</div>
);
}