This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(typography): add feature targeting for styles #4305
Merged
kfranqueiro
merged 3 commits into
material-components:master
from
mmalerba:sass-2nd-pass
Jan 29, 2019
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,33 @@ | ||
@import "@material/feature-targeting/functions"; | ||
@import "@material/button/mixins"; | ||
@import "@material/checkbox/mixins"; | ||
@import "@material/radio/mixins"; | ||
@import "@material/feature-targeting/functions"; | ||
@import "@material/menu/mixins"; | ||
@import "@material/radio/mixins"; | ||
@import "@material/typography/mixins"; | ||
|
||
// Button | ||
|
||
@include mdc-button($query: mdc-feature-any()); | ||
|
||
// Checkbox | ||
|
||
@include mdc-checkbox($query: mdc-feature-any()); | ||
@include mdc-radio($query: mdc-feature-any()); | ||
|
||
// Menu | ||
|
||
@include mdc-menu($query: mdc-feature-any()); | ||
|
||
// Radio | ||
|
||
@include mdc-radio($query: mdc-feature-any()); | ||
|
||
// Typography | ||
|
||
@include mdc-typography-base($query: mdc-feature-any()); | ||
@include mdc-typography(button, $query: mdc-feature-any()); | ||
@include mdc-typography-overflow-ellipsis($query: mdc-feature-any()); | ||
|
||
div { | ||
@include mdc-typography-baseline-top(0, $query: mdc-feature-any()); | ||
@include mdc-typography-baseline-bottom(0, $query: mdc-feature-any()); | ||
} |
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.
why not include all the styles inside single
@include
block?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 remember @kfranqueiro mentioning on another PR (can't remember where exactly) that he preferred this:
over this:
I agree that this makes it easier to read the file because you can follow the selectors down first, and then worry about what feature you're targetting at the very end
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 ok. Thanks for explaining!
Yes, packaging feature related styles (ie,
structure
) into one block might be good for readability. But if you think it is consistent with other files this looks good.WDYT @kfranqueiro ?
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.
Yeah, this was based on a comment I made on one of the other PRs. IIRC I specifically commented in a case where writing selectors nested within feature-targets blocks ended up causing redundant selectors in output compared to before, so this also serves to discourage that from happening, as well as just more closely mirroring how you'd write CSS if you were to ignore the feature-targets stuff.