-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Card action buttons alignment (#559)
### 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](https://user-images.githubusercontent.com/7827311/46173876-d2659600-c2a7-11e8-8506-1b95d17a58c2.png) 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](https://user-images.githubusercontent.com/7827311/46172613-3d14d280-c2a4-11e8-8f7d-502c4f007cf8.png) 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](https://snack.expo.io/HyqcT35KX), 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: <img width="377" alt="screen shot 2018-09-27 at 22 21 01" src="https://user-images.githubusercontent.com/7827311/46172934-2a4ecd80-c2a5-11e8-9364-17911a79cce3.png"> So it works for the expo examples case, but not really for the [mentioned issue](#556). 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: <img width="376" alt="screen shot 2018-09-27 at 22 13 03" src="https://user-images.githubusercontent.com/7827311/46173141-b95be580-c2a5-11e8-88dd-82a15f5981a5.png"> 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
- Loading branch information
Showing
6 changed files
with
16 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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