-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ffe82f2
commit 6b51bd5
Showing
11 changed files
with
216 additions
and
38 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
67 changes: 62 additions & 5 deletions
67
angular-ngrx-material-snackbar/src/app/components/snackbar-demo/snackbar-demo.component.ts
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,17 +1,74 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Store } from '@ngrx/store'; | ||
import { SnackbarState } from 'src/app/store/reducers/snackbar.reducer'; | ||
import { | ||
OpenSnackbars, | ||
OpenSnackbarsFromEffect | ||
} from 'src/app/store/actions/snackbar.actions'; | ||
import { | ||
snackbarSUCCESS, | ||
snackbarERROR, | ||
snackbarINFO | ||
} from 'src/app/constants'; | ||
import { of, Observable } from 'rxjs'; | ||
|
||
@Component({ | ||
selector: 'app-snackbar-demo', | ||
templateUrl: './snackbar-demo.component.html', | ||
styleUrls: ['./snackbar-demo.component.scss'] | ||
}) | ||
export class SnackbarDemoComponent implements OnInit { | ||
constructor() {} | ||
copyright$: Observable<Date> = of(new Date()); | ||
|
||
constructor(private sbStore: Store<SnackbarState>) {} | ||
|
||
ngOnInit() {} | ||
|
||
openSuccess(event: any) {} | ||
openInfo(event: any) {} | ||
openError(event: any) {} | ||
openEffect(event: any) {} | ||
openSuccess(event: any) { | ||
this.sbStore.dispatch( | ||
OpenSnackbars({ | ||
config: { | ||
message: 'You opened Success', | ||
action: 'Close', | ||
config: snackbarSUCCESS | ||
} | ||
}) | ||
); | ||
} | ||
|
||
openInfo(event: any) { | ||
this.sbStore.dispatch( | ||
OpenSnackbars({ | ||
config: { | ||
message: 'You opened Info', | ||
action: 'Close', | ||
config: snackbarINFO | ||
} | ||
}) | ||
); | ||
} | ||
|
||
openError(event: any) { | ||
this.sbStore.dispatch( | ||
OpenSnackbars({ | ||
config: { | ||
message: 'You opened Error', | ||
action: 'Close', | ||
config: snackbarERROR | ||
} | ||
}) | ||
); | ||
} | ||
|
||
openEffect(event: any) { | ||
this.sbStore.dispatch( | ||
OpenSnackbarsFromEffect({ | ||
config: { | ||
message: 'You opened Snackar from effect', | ||
action: 'Yep!', | ||
config: snackbarSUCCESS | ||
} | ||
}) | ||
); | ||
} | ||
} |
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
3 changes: 2 additions & 1 deletion
3
angular-ngrx-material-snackbar/src/app/store/reducers/snackbar.reducer.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
<!doctype html> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>AngularNgrxMaterialSnackbar</title> | ||
<base href="/"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="icon" type="image/x-icon" href="favicon.ico"> | ||
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,500,600,700" rel="stylesheet"> | ||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> | ||
</head> | ||
<body> | ||
<app-root></app-root> | ||
</body> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>AngularNgrxMaterialSnackbar</title> | ||
<base href="/" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link rel="icon" type="image/x-icon" href="favicon.ico" /> | ||
<link | ||
href="https://fonts.googleapis.com/css?family=Montserrat:400,500,600,700" | ||
rel="stylesheet" | ||
/> | ||
<link | ||
href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" | ||
rel="stylesheet" | ||
integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" | ||
crossorigin="anonymous" | ||
/> | ||
</head> | ||
<body> | ||
<app-root></app-root> | ||
</body> | ||
</html> |