Skip to content
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

feat(tab): Update tab color and typography #3108

Merged
merged 4 commits into from
Jul 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/mdc-tab/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@
// limitations under the License.
//

$mdc-tab-baseline-color: rgba(25, 25, 25, .6);
$mdc-tab-icon-size: 24px;
$mdc-tab-height: 48px;
$mdc-tab-stacked-height: 72px;
$mdc-tab-text-label-opacity: .6;
$mdc-tab-icon-opacity: .54;
32 changes: 20 additions & 12 deletions packages/mdc-tab/mdc-tab.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@
@import "./variables";

.mdc-tab {
@include mdc-tab-text-label-color($mdc-tab-baseline-color);
@include mdc-tab-icon-color($mdc-tab-baseline-color);
@include mdc-tab-text-label-color(on-surface);
@include mdc-tab-icon-color(on-surface);
@include mdc-tab-indicator-surface;
@include mdc-typography(button);

display: flex;
flex: 1 0 auto;
justify-content: center;
box-sizing: border-box;
height: 48px;
height: $mdc-tab-height;
padding: 0 24px;
border: none;
outline: none;
Expand Down Expand Up @@ -69,22 +70,25 @@
}

.mdc-tab__text-label {
@include mdc-typography-base;

display: inline-block;
padding: 16px 0 20px;
font-size: 14px;
font-weight: 500;
opacity: $mdc-tab-text-label-opacity;
// Setting line-height here overrides the line-height from the typography
// mixin above. The line-height needs to be overridden so that the spacing
// between the text label and the icon as well as the text label and the
// bottom of the tab remain the same.
line-height: 1;
}

.mdc-tab__icon {
width: 24px;
height: 24px;
width: $mdc-tab-icon-size;
height: $mdc-tab-icon-size;
padding: 12px 0;
opacity: $mdc-tab-icon-opacity;
}

.mdc-tab--stacked {
height: 72px;
height: $mdc-tab-stacked-height;
}

.mdc-tab--stacked .mdc-tab__content {
Expand All @@ -98,15 +102,14 @@

.mdc-tab--stacked .mdc-tab__text-label {
padding: 0 0 16px;
line-height: 12px;
}

// The [de]activation animation affects color for text label and icon
.mdc-tab--animating-activate .mdc-tab__text-label,
.mdc-tab--animating-activate .mdc-tab__icon,
.mdc-tab--animating-deactivate .mdc-tab__text-label,
.mdc-tab--animating-deactivate .mdc-tab__icon {
transition: 150ms color linear;
transition: 150ms color linear, 150ms opacity linear;
}

// The activation animation has a delay of 100ms
Expand All @@ -118,6 +121,11 @@
.mdc-tab--active {
@include mdc-tab-text-label-color(primary);
@include mdc-tab-icon-color(primary);

.mdc-tab__text-label,
.mdc-tab__icon {
opacity: 1;
}
}

.mdc-tab .mdc-tab__icon + .mdc-tab__text-label {
Expand Down