-
Notifications
You must be signed in to change notification settings - Fork 2.9k
react-card - CardPreview top padding fix #20030
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-card-eef6d228-043e-411b-87c8-94969a3e7cab.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "type": "prerelease", | ||
| "comment": "CardPreview removes own top margin when the first element in a Card", | ||
| "packageName": "@fluentui/react-card", | ||
| "email": "andredias@microsoft.com", | ||
| "dependentChangeType": "patch" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
I think it is not a very good practice to use negative values for margins, maybe (if it is possible) removing the margin from the above component could be better?
Also, the values are fixed, could there be a possibility that the card might not look as it should because of 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.
Regarding negating the margins, I'm also not a fan of this solution but I think it's a compromise between elegance and utility.
I had already discussed this topic with @varholak-peter about having the padding instead on the child components (CardHeader, CardPreview, etc), which would potentially remove this issue as each component governs itself. However, I see 2 issues with this:
sizeprop on Card (according to the current spec), we'll need to change this padding as it won't always be the fixed 12px. This means that we'd probably need to provide some CardContext for the inner components to consume and be compliant.Given these 2 constraints, I think the less elegant negative margin solution is the better option as it will guarantee it's Fluent by default, allow us to control the padding from the parent (whenever we have
size) and avoid duplicate code on the inner components.Regardless of what we choose, we felt it was a discussion that needed to happen more in depth and opted for this just to fast track it for now.
As for the mention about fixed values, 12px matches the, eventual, default
sizefor card which ismedium. Given that thesizeprop won't be implemented for phase 1, we went with a fixed value for now.