-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(material-experimental/theming): implement M3 badge (#28460)
Aligns the badge with the M3 spec. This required a few issues to be fixed: 1. The badge was being sized with `width` and `height`. This is incorrect, because it prevents the badge from scaling with the text. I've resolved it while keeping the old behavior by introducing new tokens that target `min-width` and `min-height` while the old ones still target `width` and `height`. 2. The badge was being positioned purely with `top`, `bottom`, `left` and `right`. This is problematic, because it anchors the badge to the specific point in the host, causing the content to grow inwards instead of outwards. I've fixed it by using the opposite dimensions to position the badge (e.g. `bottom: 100%` instead of `top: -20px`) and then using a negative margin to offset the badge from there. This approach also has the advantage of producing less CSS. 3. The badge didn't have a padding which made the content look off if it's more than one character.
- Loading branch information
Showing
4 changed files
with
111 additions
and
69 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