Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide post footer when empty #2926

Merged
merged 5 commits into from
Jul 13, 2021
Merged

Hide post footer when empty #2926

merged 5 commits into from
Jul 13, 2021

Conversation

davwheat
Copy link
Member

Changes proposed in this pull request:

This PR changes the post footer to hide itself when it contains no items.

Currently, even if the footer has no items, it still exists and has margin, resulting in unexpected and weird white space at the bottom of posts.

In the screenshots below, notice the non-even spacing on the EventPost and on the whitespace below the post actions on the CommentPost.

I believe we previously had a more "hacky" way of doing this, by setting the footer bottom margin to 0 for Event Posts, but this fix will affect all posts instead of just Event Posts.

Reviewers should focus on:

This shouldn't be breaking (unless extensions are adding content to footers in hacky ways which we should probably discourage anyway).

As long as extensions are using the ItemList to add items to the footer, this class shouldn't end up being added.

Screenshot

Before:

image

After:

image

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).

@dsevillamartin
Copy link
Member

Why not just not draw the footer in the DOM, instead of hiding it with CSS?

@davwheat
Copy link
Member Author

davwheat commented Jun 16, 2021

I thought about that but assumed it'd be more breaking than just hiding the footer in CSS.

If someone was doing weird stuff, they could override the style if needed to force it to show.

@SychO9 SychO9 self-requested a review June 22, 2021 21:51
@SychO9 SychO9 modified the milestones: 1.0.4, 1.0.5 Jun 27, 2021
@davwheat davwheat force-pushed the dw/remove-empty-post-footer branch from 90d20c1 to 837fa83 Compare July 12, 2021 23:36
@davwheat davwheat requested a review from SychO9 July 12, 2021 23:36
@davwheat
Copy link
Member Author

@SychO9 Seems like your suggestion worked fine! Using :empty pseudoclass but rendering null if no items are in the footer (null renders as nothing, whereas '' renders as a text node it seems).

Copy link
Member

@SychO9 SychO9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@davwheat davwheat merged commit da20d75 into master Jul 13, 2021
@davwheat davwheat deleted the dw/remove-empty-post-footer branch July 13, 2021 12:42
@SychO9 SychO9 modified the milestones: 1.0.5, 1.1 Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants