forked from microsoft/fluentui-apple
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Decouple Label
and TextColorStyle
#2
Merged
amgleitman
merged 9 commits into
navbar-merge-main-2023-05-04-minus-1699
from
decouple-textcolorstyle
May 12, 2023
Merged
Decouple Label
and TextColorStyle
#2
amgleitman
merged 9 commits into
navbar-merge-main-2023-05-04-minus-1699
from
decouple-textcolorstyle
May 12, 2023
Conversation
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
laminesm
reviewed
May 11, 2023
laminesm
reviewed
May 11, 2023
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.
Do these changes have any impact on Label token overrides?
Nope, |
11 tasks
mischreiber
reviewed
May 11, 2023
laminesm
approved these changes
May 11, 2023
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.
Platforms Impacted
Description of changes
NOTE: This is currently targeted for new-2ltv, but it will be merged directly into the branch that's part of microsoft#1731 after #1 makes it in.
The discussion of microsoft#1731 uncovered a bug where label tokens don't always play nicely when placed inside parent components. The ultimate problem here is that right now, a
Label
must be defined in terms of aTextColorStyle
. This not only limits what we and consumers of FUA can do withLabel
s, but it's also an unnecessary abstraction since we usually specify labels in terms of individual typography styles and colors.Our solution is to make it such that
Label
is more closely connected toUIColor
. This gives us more flexibility in terms of what colors a label can be. It also removes the need forTextColorStyle.secondaryOnColor
, which we needed to add as a special case forTwoLineTitleView
.Note that we specify the color as a
(FluentTheme) -> UIColor
instead of just aUIColor
because brand colors (as opposed to neutral colors like "Grey 42" and shared colors like "Blue Primary") require a theme in order to be translatable to aUIColor
. See the usage in LabelDemoController.swift for an example.Verification
(how the change was tested, including both manual and automated tests)
Visual Verification
*This was created by manually changing
TwoLineTitleViewTokenSet
to showUIColor.systemRed
for the title andUIColor.systemOrange
for the subtitle. This obviously isn't part of the change, but it's proof of concept that it works.Pull request checklist
This PR has considered: