Skip to content

Commit

Permalink
fix(snack-bar): allow multi-line text
Browse files Browse the repository at this point in the history
* Wraps multi-line text, instead of truncating it, inside of snack bars. **Note:** While the spec only mentions multi-line text on mobile, this seems to be a better approach than cutting it off at ~500px. We can revisit this if we start using media queries.
* Aligns the snack bar button margin to the spec.
* Simplifies some of the CSS to remove the need for a hardcoded height and negative margins.

Fixes angular#1951.
  • Loading branch information
crisbeto committed Mar 15, 2017
1 parent 05c865d commit 97e1081
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/lib/snack-bar/simple-snack-bar.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<span class="mat-simple-snackbar-message">{{message}}</span>
{{message}}
<button class="mat-simple-snackbar-action" *ngIf="hasAction" (click)="dismiss()">{{action}}</button>
11 changes: 4 additions & 7 deletions src/lib/snack-bar/simple-snack-bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
@import '../core/style/button-common';
@import '../core/style/list-common';

$mat-snack-bar-button-margin: 48px !default;

:host {
display: flex;
justify-content: space-between;
Expand All @@ -13,20 +15,15 @@
}
}

.mat-simple-snackbar-message {
@include mat-truncate-line;
}

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

background: none;
margin: -5px 0 0;
padding: 5px;
text-transform: uppercase;
color: inherit;
line-height: inherit;
line-height: 1;
flex-shrink: 0;
margin-left: $mat-snack-bar-button-margin;
font: {
family: inherit;
size: inherit;
Expand Down
3 changes: 0 additions & 3 deletions src/lib/snack-bar/snack-bar-container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
@import '../core/a11y/a11y';

$mat-snack-bar-padding: 14px 24px !default;
$mat-snack-bar-height: 20px !default;
$mat-snack-bar-min-width: 288px !default;
$mat-snack-bar-max-width: 568px !default;

Expand All @@ -13,10 +12,8 @@ $mat-snack-bar-max-width: 568px !default;
border-radius: 2px;
box-sizing: content-box;
display: block;
height: $mat-snack-bar-height;
max-width: $mat-snack-bar-max-width;
min-width: $mat-snack-bar-min-width;
overflow: hidden;
padding: $mat-snack-bar-padding;
// Initial transformation is applied to start snack bar out of view.
transform: translateY(100%);
Expand Down

0 comments on commit 97e1081

Please sign in to comment.