diff --git a/src/components/notification/notification.component.html b/src/components/notification/notification.component.html index a7c5dbd..9d17851 100644 --- a/src/components/notification/notification.component.html +++ b/src/components/notification/notification.component.html @@ -1,11 +1,11 @@
{{ data.message }} - +
@if (showProgressBar) { - + } diff --git a/src/components/notification/notification.component.ts b/src/components/notification/notification.component.ts index f065398..d74d56b 100644 --- a/src/components/notification/notification.component.ts +++ b/src/components/notification/notification.component.ts @@ -19,12 +19,16 @@ import {MatIconButton} from "@angular/material/button"; export class NotificationComponent { showProgressBar: boolean = false; progress: number = 100; + color: string = "primary"; constructor(@Inject(MAT_SNACK_BAR_DATA) public data: any, private snackBarRef: MatSnackBarRef) { if (data.duration) { this.startProgress(data.duration); this.showProgressBar = true; } + if (data.color) { + this.color = data.color; + } } dismiss(): void { diff --git a/src/services/open-notify.service.ts b/src/services/open-notify.service.ts index de07ea9..c935dff 100644 --- a/src/services/open-notify.service.ts +++ b/src/services/open-notify.service.ts @@ -43,7 +43,12 @@ export class OpenNotifyService { open(message: string, color: NotifyColor = NotifyColor.Basic, duration: number = 5000) { this.setColorClass = color; this._snackBar.openFromComponent(NotificationComponent, { - data: {message: message, duration: duration, className: this.colorClass}, + data: { + message: message, + duration: duration, + className: this.colorClass, + color: color === NotifyColor.Danger ? "accent" : "primary" + }, duration: duration, verticalPosition: 'top', horizontalPosition: 'center',