Skip to content
Closed
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
54 changes: 24 additions & 30 deletions src/material/button/_button-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,14 @@
}

@mixin color($theme) {
.mat-mdc-button {
@include sass-utils.current-selector-or-root() {
@include _text-button-variant($theme, null);
@include _filled-button-variant($theme, null);
@include _protected-button-variant($theme, null);
@include _outlined-button-variant($theme, null);
}

.mat-mdc-button {
&.mat-primary {
@include _text-button-variant($theme, primary);
}
Expand All @@ -102,8 +107,6 @@
}

.mat-mdc-unelevated-button {
@include _filled-button-variant($theme, null);

&.mat-primary {
@include _filled-button-variant($theme, primary);
}
Expand All @@ -118,8 +121,6 @@
}

.mat-mdc-raised-button {
@include _protected-button-variant($theme, null);

&.mat-primary {
@include _protected-button-variant($theme, primary);
}
Expand Down Expand Up @@ -147,8 +148,6 @@
}

.mat-mdc-outlined-button {
@include _outlined-button-variant($theme, null);

&.mat-primary {
@include _outlined-button-variant($theme, primary);
}
Expand All @@ -164,12 +163,12 @@
}

@mixin typography($theme) {
@include sass-utils.current-selector-or-root() {
$text-typography-tokens: tokens-mdc-text-button.get-typography-tokens($theme);
$filled-typography-tokens: tokens-mdc-filled-button.get-typography-tokens($theme);
$outlined-typography-tokens: tokens-mdc-outlined-button.get-typography-tokens($theme);
$protected-typography-tokens: tokens-mdc-protected-button.get-typography-tokens($theme);
$text-typography-tokens: tokens-mdc-text-button.get-typography-tokens($theme);
$filled-typography-tokens: tokens-mdc-filled-button.get-typography-tokens($theme);
$outlined-typography-tokens: tokens-mdc-outlined-button.get-typography-tokens($theme);
$protected-typography-tokens: tokens-mdc-protected-button.get-typography-tokens($theme);

@include sass-utils.current-selector-or-root() {
@include mdc-button-text-theme.theme($text-typography-tokens);
@include mdc-button-filled-theme.theme($filled-typography-tokens);
@include mdc-button-outlined-theme.theme($outlined-typography-tokens);
Expand All @@ -179,28 +178,23 @@

@mixin density($theme) {
$density-scale: theming.clamp-density(inspection.get-theme-density($theme), -3);
$text-density-tokens: tokens-mdc-text-button.get-density-tokens($theme);
$filled-density-tokens: tokens-mdc-filled-button.get-density-tokens($theme);
$outlined-density-tokens: tokens-mdc-outlined-button.get-density-tokens($theme);
$protected-density-tokens: tokens-mdc-protected-button.get-density-tokens($theme);

.mat-mdc-button {
$density-tokens: tokens-mdc-text-button.get-density-tokens($theme);
@include mdc-button-text-theme.theme($density-tokens);
@include button-base.mat-private-button-touch-target-density($density-scale);
}

.mat-mdc-raised-button {
$density-tokens: tokens-mdc-protected-button.get-density-tokens($theme);
@include mdc-button-protected-theme.theme($density-tokens);
@include button-base.mat-private-button-touch-target-density($density-scale);
}

.mat-mdc-unelevated-button {
$density-tokens: tokens-mdc-filled-button.get-density-tokens($theme);
@include mdc-button-filled-theme.theme($density-tokens);
@include button-base.mat-private-button-touch-target-density($density-scale);
@include sass-utils.current-selector-or-root() {
@include mdc-button-text-theme.theme($text-density-tokens);
@include mdc-button-filled-theme.theme($filled-density-tokens);
@include mdc-button-outlined-theme.theme($outlined-density-tokens);
@include mdc-button-protected-theme.theme($protected-density-tokens);
}

.mat-mdc-button,
.mat-mdc-raised-button,
.mat-mdc-unelevated-button,
.mat-mdc-outlined-button {
$density-tokens: tokens-mdc-outlined-button.get-density-tokens($theme);
@include mdc-button-outlined-theme.theme($density-tokens);
// TODO: tokenize the touch target visibility.
@include button-base.mat-private-button-touch-target-density($density-scale);
}
}
Expand Down
20 changes: 11 additions & 9 deletions src/material/button/_icon-button-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,21 @@
@include _theme-from-tokens(inspection.get-theme-tokens($theme, color));
}
@else {
.mat-mdc-icon-button {
@include sass-utils.current-selector-or-root() {
@include _icon-button-variant($theme, null);

&.mat-primary {
@include _icon-button-variant($theme, primary);
}
.mat-mdc-icon-button {
&.mat-primary {
@include _icon-button-variant($theme, primary);
}

&.mat-accent {
@include _icon-button-variant($theme, accent);
}
&.mat-accent {
@include _icon-button-variant($theme, accent);
}

&.mat-warn {
@include _icon-button-variant($theme, warn);
&.mat-warn {
@include _icon-button-variant($theme, warn);
}
}
}
}
Expand Down