From da20d75e3c47551714897933c45434a4b1d1e39c Mon Sep 17 00:00:00 2001 From: David Wheatley Date: Tue, 13 Jul 2021 13:42:19 +0100 Subject: [PATCH] Hide post footer when empty (#2926) * Add `Post-footer--empty` class if the post footer contains no items * Hide post footer when it has class `Post-footer--empty` * Swap to `:empty` pseudoselector * Prefer ternary operator * Fix typo --- js/src/forum/components/Post.js | 5 ++--- less/forum/Post.less | 7 ++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/js/src/forum/components/Post.js b/js/src/forum/components/Post.js index de9aa4b17..221c9fee4 100644 --- a/js/src/forum/components/Post.js +++ b/js/src/forum/components/Post.js @@ -44,6 +44,7 @@ export default class Post extends Component { attrs.className = this.classes(attrs.className).join(' '); const controls = PostControls.controls(this.attrs.post, this).toArray(); + const footerItems = this.footerItems().toArray(); return (
@@ -71,9 +72,7 @@ export default class Post extends Component { )} -
-
    {listItems(this.footerItems().toArray())}
-
+
); diff --git a/less/forum/Post.less b/less/forum/Post.less index d0af5abac..3f3761bd7 100644 --- a/less/forum/Post.less +++ b/less/forum/Post.less @@ -247,9 +247,6 @@ a { font-weight: bold; } - .Post-footer { - margin-bottom: 0; - } } .EventPost-info { font-size: 14px; @@ -287,6 +284,10 @@ font-size: 14px; margin-right: 5px; } + + &:empty { + display: none; + } } .Post-actions { margin-top: -5px;