diff --git a/ui-ngx/src/app/core/notification/notification.models.ts b/ui-ngx/src/app/core/notification/notification.models.ts index 1d658a5b9e..37e2177d62 100644 --- a/ui-ngx/src/app/core/notification/notification.models.ts +++ b/ui-ngx/src/app/core/notification/notification.models.ts @@ -33,6 +33,7 @@ export class NotificationMessage { horizontalPosition?: NotificationHorizontalPosition; verticalPosition?: NotificationVerticalPosition; panelClass?: string | string[]; + modern?: boolean; } export class HideNotification { diff --git a/ui-ngx/src/app/modules/home/models/widget-component.models.ts b/ui-ngx/src/app/modules/home/models/widget-component.models.ts index 63193a2ea7..2ea34377d6 100644 --- a/ui-ngx/src/app/modules/home/models/widget-component.models.ts +++ b/ui-ngx/src/app/modules/home/models/widget-component.models.ts @@ -349,35 +349,35 @@ export class WidgetContext { showSuccessToast(message: string, duration: number = 1000, verticalPosition: NotificationVerticalPosition = 'bottom', horizontalPosition: NotificationHorizontalPosition = 'left', - target: string = 'dashboardRoot') { - this.showToast('success', message, duration, verticalPosition, horizontalPosition, target); + target: string = 'dashboardRoot', modern = false) { + this.showToast('success', message, duration, verticalPosition, horizontalPosition, target, modern); } showInfoToast(message: string, verticalPosition: NotificationVerticalPosition = 'bottom', horizontalPosition: NotificationHorizontalPosition = 'left', - target: string = 'dashboardRoot') { - this.showToast('info', message, undefined, verticalPosition, horizontalPosition, target); + target: string = 'dashboardRoot', modern = false) { + this.showToast('info', message, undefined, verticalPosition, horizontalPosition, target, modern); } showWarnToast(message: string, verticalPosition: NotificationVerticalPosition = 'bottom', horizontalPosition: NotificationHorizontalPosition = 'left', - target: string = 'dashboardRoot') { - this.showToast('warn', message, undefined, verticalPosition, horizontalPosition, target); + target: string = 'dashboardRoot', modern = false) { + this.showToast('warn', message, undefined, verticalPosition, horizontalPosition, target, modern); } showErrorToast(message: string, verticalPosition: NotificationVerticalPosition = 'bottom', horizontalPosition: NotificationHorizontalPosition = 'left', - target: string = 'dashboardRoot') { - this.showToast('error', message, undefined, verticalPosition, horizontalPosition, target); + target: string = 'dashboardRoot', modern = false) { + this.showToast('error', message, undefined, verticalPosition, horizontalPosition, target, modern); } showToast(type: NotificationType, message: string, duration: number, verticalPosition: NotificationVerticalPosition = 'bottom', horizontalPosition: NotificationHorizontalPosition = 'left', - target: string = 'dashboardRoot') { + target: string = 'dashboardRoot', modern = false) { this.store.dispatch(new ActionNotificationShow( { message, @@ -387,7 +387,8 @@ export class WidgetContext { horizontalPosition, target, panelClass: this.widgetNamespace, - forceDismiss: true + forceDismiss: true, + modern })); } diff --git a/ui-ngx/src/app/shared/components/snack-bar-component.html b/ui-ngx/src/app/shared/components/snack-bar-component.html index cb39b98f48..ca70f6b476 100644 --- a/ui-ngx/src/app/shared/components/snack-bar-component.html +++ b/ui-ngx/src/app/shared/components/snack-bar-component.html @@ -15,15 +15,30 @@ limitations under the License. --> -
-
- + +
+ +
+ +
+
+ +
+
diff --git a/ui-ngx/src/app/shared/components/snack-bar-component.scss b/ui-ngx/src/app/shared/components/snack-bar-component.scss index 97531e220e..d86b740fc3 100644 --- a/ui-ngx/src/app/shared/components/snack-bar-component.scss +++ b/ui-ngx/src/app/shared/components/snack-bar-component.scss @@ -71,4 +71,42 @@ background: #008000; } } + + .tb-modern-toast { + display: flex; + flex-direction: column; + z-index: 1; + &-panel { + display: flex; + padding: 4px 4px 4px 12px; + justify-content: center; + align-items: center; + gap: 4px; + border-radius: 4px; + box-shadow: -2px 2px 4px 0px rgba(0,0,0,0.2); + &.info-toast { + background: #e6e6e6; + color: rgba(50, 50, 50, 1); + } + &.warn-toast { + background: #fff3eb; + color: rgba(220, 109, 27, 1); + + } + &.error-toast { + background-color: #fff2f3; + color: rgba(209, 39, 48, 1); + } + &.success-toast { + background: #ebfcec; + color: rgba(0, 128, 0, 1); + } + } + .toast-text { + font-size: 12px; + font-style: normal; + font-weight: 400; + line-height: 16px; + } + } } diff --git a/ui-ngx/src/app/shared/components/toast.directive.ts b/ui-ngx/src/app/shared/components/toast.directive.ts index 6881460f6a..c096ba2a5a 100644 --- a/ui-ngx/src/app/shared/components/toast.directive.ts +++ b/ui-ngx/src/app/shared/components/toast.directive.ts @@ -280,7 +280,7 @@ export type ToastAnimationState = 'default' | 'opened' | 'closing'; }) export class TbSnackBarComponent implements AfterViewInit, OnDestroy { - @ViewChild('actionButton', {static: true}) actionButton: MatButton; + @ViewChild('actionButton') actionButton: MatButton; @HostBinding('class') get panelClass(): string[] {