-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(snack-bar): allow addition of extra css classes (#2804)
Fixes #2664.
- Loading branch information
Showing
7 changed files
with
58 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
.demo-button-label-input { | ||
display: inline-block; | ||
} | ||
.party { | ||
animation: party 5000ms infinite; | ||
} | ||
|
||
@keyframes party { | ||
0% { background: #00f; } | ||
10% { background: #8e44ad; } | ||
20% { background: #1abc9c; } | ||
30% { background: #d35400; } | ||
40% { background: #00f; } | ||
50% { background: #34495e; } | ||
60% { background: #00f; } | ||
70% { background: #2980b9; } | ||
80% { background: #f1c40f; } | ||
90% { background: #2980b9; } | ||
100% { background: #0ff; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
import {Component} from '@angular/core'; | ||
import {Component, ViewEncapsulation} from '@angular/core'; | ||
import {MdSnackBar, MdSnackBarConfig} from '@angular/material'; | ||
|
||
@Component({ | ||
moduleId: module.id, | ||
selector: 'snack-bar-demo', | ||
styleUrls: ['snack-bar-demo.css'], | ||
templateUrl: 'snack-bar-demo.html', | ||
encapsulation: ViewEncapsulation.None, | ||
}) | ||
export class SnackBarDemo { | ||
message: string = 'Snack Bar opened.'; | ||
actionButtonLabel: string = 'Retry'; | ||
action: boolean = false; | ||
setAutoHide: boolean = true; | ||
autoHide: number = 0; | ||
autoHide: number = 10000; | ||
addExtraClass: boolean = false; | ||
|
||
constructor( | ||
public snackBar: MdSnackBar) { } | ||
constructor(public snackBar: MdSnackBar) { } | ||
|
||
open() { | ||
let config = new MdSnackBarConfig(); | ||
config.duration = this.autoHide; | ||
config.extraClasses = this.addExtraClass ? ['party'] : null; | ||
this.snackBar.open(this.message, this.action && this.actionButtonLabel, config); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Please see the official documentation at https://material.angular.io/components/component/snack-bar | ||
Please see the official documentation at https://material.angular.io/components/component/snack-bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters