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

No spacing between version status/autosave and render fields in the sidebar #2478

Closed
qbeauperin opened this issue Apr 11, 2023 · 3 comments · Fixed by #2513
Closed

No spacing between version status/autosave and render fields in the sidebar #2478

qbeauperin opened this issue Apr 11, 2023 · 3 comments · Fixed by #2513
Assignees
Labels
status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@qbeauperin
Copy link
Contributor

Link to reproduction

default versions test

To Reproduce

  • Clone the Payload repo

  • In the versions test, add a new field in the sidebar of the Drafts and Autosave collections, for example:

    {
        name: 'date',
        label: 'Date',
        type: 'date',
        admin: {
          position: 'sidebar',
        }
      },
  • Run the test (yarn dev versions)

  • Check the various collection pages and notice how there's no spacing between the version status/autosave status and the sidebar fields.

Describe the Bug

There's no spacing between the version status/autosave status and the sidebar fields.
I'd suggest adding a $baseline margin between the two.


Autosave (before/after):
image image

Versions (before/after):
image image


Happy to make a PR for it, but wondering about the best approach. I can see a couple options:

  1. Apply margin-bottom to &:has(+ .render-fields) on both .status and .autosave: this would keep the spacing logic confined to their respective components. The issue is that :has isn't yet fully supported.
  2. Apply margin-top to & + .render-fields on both .status and .autosave: alternative to 1.
  3. Wrap both .status and .autosave into a common div or component: both 1. and 2. wouldn't be very future proof and adding another element in between or renaming the .render-fields div would break the fix, so given how logically tied these two elements are, I feel like the best solution would be to wrap them into their own components, and have the bottom margin applied to it.

Payload Version

1.6.32

@jacobsfletch
Copy link
Member

@qbeauperin thank you taking the time to report on this! Much appreciated. The simplest fix here was to use CSS display: flex along with the gap: $baseline;. This is essentially the same as > *:not(:last-child) { margin-bottom: $baseline; } which also would have done the trick. Check it out a45ab8b

@qbeauperin
Copy link
Contributor Author

Ha, much better solve indeed! 🎉

Copy link
Contributor

github-actions bot commented Sep 7, 2024

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants