Skip to content

Commit 363562f

Browse files
crisbetokara
authored andcommitted
fix(snack-bar): align theming with spec (#6506)
1 parent 90fc300 commit 363562f

File tree

7 files changed

+43
-32
lines changed

7 files changed

+43
-32
lines changed

src/lib/core/theming/_all-theme.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
@import '../../tabs/tabs-theme';
2727
@import '../../toolbar/toolbar-theme';
2828
@import '../../tooltip/tooltip-theme';
29-
@import '../../snack-bar/simple-snack-bar-theme';
29+
@import '../../snack-bar/snack-bar-theme';
3030
@import '../../form-field/form-field-theme';
3131

3232

@@ -60,5 +60,5 @@
6060
@include mat-tabs-theme($theme);
6161
@include mat-toolbar-theme($theme);
6262
@include mat-tooltip-theme($theme);
63-
@include mat-simple-snack-bar-theme($theme);
63+
@include mat-snack-bar-theme($theme);
6464
}

src/lib/core/typography/_all-typography.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
@import '../../tabs/tabs-theme';
2626
@import '../../toolbar/toolbar-theme';
2727
@import '../../tooltip/tooltip-theme';
28-
@import '../../snack-bar/simple-snack-bar-theme';
28+
@import '../../snack-bar/snack-bar-theme';
2929
@import '../option/option-theme';
3030
@import '../option/optgroup-theme';
3131
@import '../../form-field/form-field-theme';
@@ -67,5 +67,5 @@
6767
@include mat-list-typography($config);
6868
@include mat-option-typography($config);
6969
@include mat-optgroup-typography($config);
70-
@include mat-simple-snack-bar-typography($config);
70+
@include mat-snack-bar-typography($config);
7171
}

src/lib/snack-bar/_simple-snack-bar-theme.scss

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
@import '../core/typography/typography-utils';
2+
@import '../core/theming/palette';
3+
4+
@mixin mat-snack-bar-theme($theme) {
5+
$is-dark-theme: map-get($theme, is-dark);
6+
$accent: map-get($theme, accent);
7+
8+
.mat-snack-bar-container {
9+
background: if($is-dark-theme, map-get($mat-grey, 50), #323232);
10+
color: if($is-dark-theme, $black-87-opacity, white);
11+
}
12+
13+
.mat-simple-snackbar-action {
14+
color: if($is-dark-theme, inherit, mat-color($accent));
15+
}
16+
}
17+
18+
@mixin mat-snack-bar-typography($config) {
19+
.mat-simple-snackbar {
20+
font: {
21+
family: mat-font-family($config, body-1);
22+
size: mat-font-size($config, body-1);
23+
}
24+
}
25+
26+
.mat-simple-snackbar-action {
27+
line-height: 1;
28+
font: {
29+
family: inherit;
30+
size: inherit;
31+
weight: mat-font-weight($config, button);
32+
}
33+
}
34+
}

src/lib/snack-bar/simple-snack-bar.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@ $mat-snack-bar-button-margin: 48px !default;
77
.mat-simple-snackbar {
88
display: flex;
99
justify-content: space-between;
10-
color: white;
1110
line-height: 20px;
1211
}
1312

1413
.mat-simple-snackbar-action {
1514
@include mat-button-reset;
1615

1716
background: none;
18-
color: inherit;
1917
flex-shrink: 0;
2018
margin-left: $mat-snack-bar-button-margin;
2119

src/lib/snack-bar/snack-bar-container.scss

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
@import '../core/style/elevation';
21
@import '../core/a11y/a11y';
32

43
$mat-snack-bar-padding: 14px 24px !default;
54
$mat-snack-bar-min-width: 288px !default;
65
$mat-snack-bar-max-width: 568px !default;
76

87

9-
:host {
10-
@include mat-elevation(6);
11-
background: #323232;
8+
.mat-snack-bar-container {
129
border-radius: 2px;
1310
box-sizing: content-box;
1411
display: block;

src/lib/snack-bar/snack-bar-container.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import {
1515
OnDestroy,
1616
Renderer2,
1717
ElementRef,
18-
ChangeDetectionStrategy
18+
ChangeDetectionStrategy,
19+
ViewEncapsulation,
1920
} from '@angular/core';
2021
import {
2122
trigger,
@@ -53,8 +54,10 @@ export const HIDE_ANIMATION = '195ms cubic-bezier(0.0,0.0,0.2,1)';
5354
templateUrl: 'snack-bar-container.html',
5455
styleUrls: ['snack-bar-container.css'],
5556
changeDetection: ChangeDetectionStrategy.OnPush,
57+
encapsulation: ViewEncapsulation.None,
5658
host: {
5759
'role': 'alert',
60+
'class': 'mat-snack-bar-container',
5861
'[@state]': 'animationState',
5962
'(@state.done)': 'onAnimationEnd($event)'
6063
},

0 commit comments

Comments
 (0)