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

fix: Card action buttons align #559

Merged
merged 3 commits into from
Oct 4, 2018

Conversation

gawrysiak
Copy link
Collaborator

@gawrysiak gawrysiak commented Sep 27, 2018

Motivation

Fixes #556. It appears like the default card actions padding is slightly wrong. The issue affects buttons as well.

This is somehow a possibly minor, but breaking change for existing projects, so I'll try to explain what's going on.

Resources

Cards
screen shot 2018-09-27 at 22 50 47
According to MD guidelines the card actions padding is 8. The content's padding is 16. Cards use the "compact" buttons with smaller padding - 8 instead of standard 16.

Buttons
screen shot 2018-09-27 at 22 09 27
The standard horizontal padding is 16. Although it's different for card action buttons. Notice the min-width value, which is 64, but the buttons section doesn't really describe the compact buttons.

Solution

The example provided by @brunohkbx presented a case where it got caught into the min-width trap. The text was too small and caused a larger button padding. If you run this expo snack, it presents the same case, just with different button text. First goes too far to the right, second goes too far to the left.

The first thing to fix was the card actions padding - switch from 4 to 8. It results in:
screen shot 2018-09-27 at 22 21 01
So it works for the expo examples case, but not really for the mentioned issue. It still gives an extra button padding due to too short text (min-width).

After removing the min-width from compact buttons, it seems like it's finally there:
screen shot 2018-09-27 at 22 13 03

Finally, it also switches the dialog actions to 8 padding, since that's basically the same thing.

Test plan

https://snack.expo.io/HydBnn5t7
Snapshot tests updated

@callstack-bot
Copy link

callstack-bot commented Sep 27, 2018

Hey @gawrysiak, thank you for your pull request 🤗. The documentation from this branch can be viewed here.

@gawrysiak gawrysiak changed the title Fix: Card action buttons align fix: Card action buttons align Sep 27, 2018
@ferrannp ferrannp requested a review from satya164 October 4, 2018 10:14
@satya164 satya164 merged commit b4fe2b5 into callstack:master Oct 4, 2018
@gawrysiak gawrysiak deleted the fix/card-actions branch October 4, 2018 12:38
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.

How to align Card.content with Card.actions?
3 participants