[ADF-4484] Quick notifications (#4688)

* quick notifications (info, error, warning)

* update code docs
This commit is contained in:
Denys Vuika
2019-05-07 13:25:12 +01:00
committed by GitHub
parent 5d49b494fa
commit 8db915bd2a
6 changed files with 88 additions and 1 deletions

View File

@@ -65,4 +65,10 @@
{{snackBarConfigObject}}
</p>
</div>
<div>
<h3>Quick Messages</h3>
<button mat-button color="primary" (click)="quickInfo()">Info</button>
<button mat-button color="warn" (click)="quickError()">Error</button>
<button mat-button color="accent" (click)="quickWarning()">Warning</button>
</div>
</div>

View File

@@ -117,4 +117,16 @@ export class NotificationsComponent implements OnInit {
dismissSnackBar() {
this.notificationService.dismissSnackMessageAction();
}
quickError() {
this.notificationService.showError(this.message, 'Fix');
}
quickInfo() {
this.notificationService.showInfo(this.message);
}
quickWarning() {
this.notificationService.showWarning(this.message, 'Undo');
}
}

View File

@@ -20,6 +20,7 @@ import { NotificationsComponent } from './notifications.component';
import { Routes, RouterModule } from '@angular/router';
import { CommonModule } from '@angular/common';
import { CoreModule } from '@alfresco/adf-core';
import { MatButtonModule } from '@angular/material/button';
const routes: Routes = [
{
@@ -32,7 +33,8 @@ const routes: Routes = [
imports: [
CommonModule,
CoreModule.forChild(),
RouterModule.forChild(routes)
RouterModule.forChild(routes),
MatButtonModule
],
declarations: [NotificationsComponent]
})