Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 This should not be necessary because every field declares its layout, and all the 3 top-level fields that create a card have
cardas the layout. That should be enough to match any styles. I'll take a look.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
In case it's not clear, this is about the spacing between the cards themselves (which should be 24px), not the fields within the cards (which should be 16px).
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wrapper layout depends on the
form.layout.type. If not present, we normalize it to the regular layout that uses4as spacing setting, while the card layout uses6(ref).This is fragile. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if it was the individual fields (each card, each panel, each regular field) that set the spacing? Something along these lines:
Would there be any issue with this? We could remove all the wrappers from the existing layouts but the row one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think something along those lines might work. I made a CodePen to explore. The rules are a bit more specific to account for specific order combos but I think this covers everything neatly.
Do you think there are any trade-offs to using margin vs gap?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oandregal any thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've approved this PR, but we can continue the conversation.
I thought about this, but I've noticed we mix panel and regular items in a few places (QuickEdit, for example). If the field themselves provide the spacing, and each layout has its own, wouldn't this create different spacing between fields in the same form?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another thought is that we make it a
cardbecause we want the spacing of a card. The spacing applied between fields is overloaded with the layout type. A different approach could be 1) remove the top-level layout prop, it's the field responsibility to declare its own 2) and a top-level gap prop to configure the spacing between fields.If we go this route, I suppose the best approach would be to connect this gap with the spacing from DS (e.g., "xs", "md").