-
Notifications
You must be signed in to change notification settings - Fork 171
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
Update Media Object to support new color theme variables #5187
Merged
pastelcyborg
merged 1 commit into
canonical:main
from
pastelcyborg:update-media-object-theming
Jun 26, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Oops, something went wrong.
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.
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.
Yes, that's the easiest way to deal with legacy components not supporting the CSS variables.
I'd just add support for having is-dark/is-light class name on itself as well:
And similar with
is-light
to make sure we can override it to light if needed.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.
I'm not sure I totally follow, @bartaz - you're saying to add the
is-dark
theme class onto thep-media-object__meta-list-item
itself? What would be the scenario in which someone would need to add the theme class directly onto this element?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.
Yes, the theme class names can be put on any level. So as a simplification for such legacy components I think it's good to at least support 2 "extremes" (setting class on body - which should be the new most common way to do it, or setting it on component itself - which was the old way to do it).
We do it in similar way in icons:
vanilla-framework/scss/_patterns_icons.scss
Lines 373 to 377 in 70b856e
This way, we should be always able to override the parent theme, by setting theme on the component.
For example if there is a mix of
is-dark
andis-light
on parent elements (because page is dark, but then there is a light strip, and in this light strip there is media object), if the media object thinks it should be "dark" (because of dark class on body), but is actually on light background, we can setis-light
on it directly, to override it.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.
Sorry, I guess I'm still misunderstanding.
The way I have it written, a descendent selector is used to implement themed icons:
If I add an additional selector in the way I'm interpreting your comment, this wouldn't really add any useful functionality:
Because there's no reason to add the theme class at this child level. My descendent selector would already handle both the cases of the theme class existing at the
body
level or at the component (.p-media-object
or similar) level.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.
Ah, sorry, my bad. They way I mentioned is supposed to be on component root element level.
You know what, it's a legacy component anyway, likely not used in any dark theme situations. So your approach should be fine. In case we spot a bug with that we will address it properly (likely by updating those icons, or redesigning that).