Skip to content

Commit 93937e6

Browse files
crisbetotinayuangao
authored andcommitted
fix(snack-bar): improper button styling and improved handling of long text (#2991)
* Simplifies the snack bar styles, removing some redundancy. * Fixes the snack bar using the `md-button` styles directly. This causes it to break if another `md-button` isn't on the page in order to import the styles. These changes switch to styling the snack bar button independently since it barely shares any styles with `md-button` anyway. * Fixes a wrong selector that wasn't styling anything. * Adds better handling for long text strings inside snack bars. Fixes #2979.
1 parent d4ba648 commit 93937e6

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
<span class="mat-simple-snackbar-message">{{message}}</span>
2-
<button md-button class="mat-simple-snackbar-action mat-button"
3-
*ngIf="hasAction" (click)="dismiss()">{{action}}</button>
2+
<button class="mat-simple-snackbar-action" *ngIf="hasAction" (click)="dismiss()">{{action}}</button>
Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,35 @@
11
@import '../core/style/variables';
2+
@import '../core/style/button-common';
3+
@import '../core/style/list-common';
24

3-
.mat-simple-snackbar {
5+
:host {
46
display: flex;
57
justify-content: space-between;
8+
color: white;
9+
line-height: 20px;
10+
font: {
11+
size: $mat-body-font-size-base;
12+
family: $mat-font-family;
13+
}
614
}
715

816
.mat-simple-snackbar-message {
9-
box-sizing: border-box;
10-
border: none;
11-
color: white;
12-
font-family: $mat-font-family;
13-
font-size: 14px;
14-
line-height: 20px;
15-
outline: none;
16-
text-decoration: none;
17-
word-break: break-all;
17+
@include mat-truncate-line;
1818
}
1919

2020
.mat-simple-snackbar-action {
21-
box-sizing: border-box;
22-
color: white;
23-
float: right;
24-
font-weight: 600;
25-
line-height: 20px;
26-
margin: -5px 0 0 48px;
27-
min-width: initial;
21+
@include mat-button-reset;
22+
23+
background: none;
24+
margin: -5px 0 0;
2825
padding: 5px;
2926
text-transform: uppercase;
30-
}
27+
color: inherit;
28+
line-height: inherit;
29+
flex-shrink: 0;
30+
font: {
31+
family: inherit;
32+
size: inherit;
33+
weight: 600;
34+
}
35+
}

0 commit comments

Comments
 (0)