Fix inset and padding on buttons with icons - #2695
Open
ganyicz wants to merge 7 commits into
Open
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Original PR
The scenario
When using a button with an icon, the padding is unbalanced
The lines represent the default padding without an icon
The problem
At this size, Heroicons come with inner padding of ~1px, pushing the icon ~2px from the edge (see 2nd and 3rd row)
We compensate for this on the default size, changing
ps-4/pe-4(16px) tops-3/pe-3(12px) when an icon is present (see 1st row)The problem is that this is inconsistent:
The solution
UPDATE:
I realized the original padding may have been adjusted for chevron which seems to have double the inner padding than the rest of the icons. With the above adjustments, the chevron is now pushed inside from the edges.
Revision:
The scenario
Horizontal inset on a default size button doesn't correctly negate padding when an icon is present.
The problem
When an icon is present, we intentionally reduce the padding on the side with the icon. This is to compensate for the padding inside the heroicon svg. Without this adjustment, the padding on the side with the icon would look bigger than on the side without it.
The problem is that inset doesn't account for this.
Additionally, the smaller sizes do not have this adjustment, which is why this bug only appears on the default size:
The solution
Update
xssize fromgap-2togap-1