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
refactor(tabs): removed ::after for css-only indicators #1983
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
577c693
refactor(tabs): removed ::after for css-only indicators
0c029c6
Merge branch 'master' into chore/tabs/css-only-indicator
ae5faff
refactor(tabs): rename mdc-tab-bar__indicator to mdc-tab__indicator i…
51a6163
Merge branch 'master' into chore/tabs/css-only-indicator
c68c9d0
chore(tabs): updated readme to reflect css-only indicators
47a41f5
Merge branch 'master' into chore/tabs/css-only-indicator
e45e407
refactor(tabs): removed more & from scss
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 |
---|---|---|
|
@@ -109,56 +109,33 @@ $mdc-tab-with-icon-and-text-height: 72px; | |
} | ||
} | ||
|
||
.mdc-tab__indicator { | ||
width: calc(100% - 4px); | ||
} | ||
|
||
// stylelint-disable plugin/selector-bem-pattern | ||
.mdc-tab-bar:not(.mdc-tab-bar-upgraded) .mdc-tab { | ||
position: relative; | ||
|
||
&::after { | ||
display: none; | ||
position: absolute; | ||
top: $mdc-tab-with-text-height - 2px; | ||
left: 0; | ||
width: calc(100% - 4px); | ||
height: 2px; | ||
content: ""; | ||
pointer-events: none; | ||
|
||
@include mdc-theme-prop(background-color, text-primary-on-light); | ||
|
||
@include mdc-theme-dark(".mdc-tab-bar", true) { | ||
@include mdc-theme-prop(background-color, text-primary-on-dark); | ||
} | ||
|
||
.mdc-toolbar & { | ||
@include mdc-theme-prop(background-color, text-primary-on-primary); | ||
&.mdc-tab--active, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're breaking BEM here, and being unnecessarily specific, you end up with
It should be
|
||
&:hover, | ||
&:active { | ||
.mdc-tab__indicator { | ||
visibility: visible; | ||
} | ||
} | ||
|
||
&--active, | ||
&:active, | ||
&:hover { | ||
&::after { | ||
display: block; | ||
} | ||
} | ||
|
||
&:not(.mdc-tab--active):hover::after { | ||
&:not(.mdc-tab--active):hover .mdc-tab__indicator { | ||
opacity: .38; | ||
} | ||
|
||
&--active, | ||
&:not(.mdc-tab--active):active::after { | ||
&:not(.mdc-tab--active):active .mdc-tab__indicator { | ||
opacity: .87; | ||
} | ||
} | ||
// stylelint-enable plugin/selector-bem-pattern | ||
|
||
// stylelint-disable plugin/selector-bem-pattern | ||
.mdc-tab-bar--icons-with-text:not(.mdc-tab-bar-upgraded) .mdc-tab::after { | ||
top: $mdc-tab-with-icon-and-text-height - 2px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you keep this logic somewhere? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is no longer needed since its addressed in the .mdc-tab__indicator { bottom: 2px; } rule |
||
} | ||
// stylelint-enable plugin/selector-bem-pattern | ||
|
||
.mdc-tab.mdc-ripple-upgraded { | ||
@include mdc-ripple-surface; | ||
@include mdc-states; | ||
|
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.
not sure if this should be in mdc-tab.scss, or if its ok to be in here.
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.
It should be in mdc-tab.scss.
Since you want to share CSS properties across the two classes, you should create a private mixin and re-use it across the two files.