Comments: don't show Expand button if no comments

## Issue
In Medium layout, the Expand/Collapse button would still appear even for 0 comments.

## Approach
Hide the button when comments = 0, but didn't hide the section because the separator line feels useful as a visual guide to mark the sections.
This commit is contained in:
infinite-persistence 2022-04-06 10:53:02 +08:00 committed by Thomas Zarebczan
parent ee03749574
commit 5380bc04f2

View file

@ -302,7 +302,7 @@ export default function CommentList(props: Props) {
{!hasDefaultExpansion && ( {!hasDefaultExpansion && (
<div className="card__bottom-actions--comments"> <div className="card__bottom-actions--comments">
{(!expandedComments || moreBelow) && ( {(!expandedComments || moreBelow) && totalComments > 0 && (
<Button <Button
button="link" button="link"
title={!expandedComments ? __('Expand') : __('More')} title={!expandedComments ? __('Expand') : __('More')}
@ -310,7 +310,7 @@ export default function CommentList(props: Props) {
onClick={() => (!expandedComments ? setExpandedComments(true) : setPage(page + 1))} onClick={() => (!expandedComments ? setExpandedComments(true) : setPage(page + 1))}
/> />
)} )}
{expandedComments && ( {expandedComments && totalComments > 0 && (
<Button <Button
button="link" button="link"
title={__('Collapse')} title={__('Collapse')}