mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 01:03:35 +00:00
UIF - Prefer signal & change detection (#16940)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { Component, OnInit, viewChild } from "@angular/core";
|
||||
import { ToastContainerDirective, ToastrService } from "ngx-toastr";
|
||||
|
||||
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
|
||||
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
|
||||
@Component({
|
||||
selector: "bit-toast-container",
|
||||
templateUrl: "toast-container.component.html",
|
||||
|
||||
@@ -25,6 +25,8 @@ const variants: Record<ToastVariant, { icon: string; bgColor: string }> = {
|
||||
},
|
||||
};
|
||||
|
||||
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
|
||||
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
|
||||
@Component({
|
||||
selector: "bit-toast",
|
||||
templateUrl: "toast.component.html",
|
||||
@@ -49,6 +51,8 @@ export class ToastComponent {
|
||||
readonly progressWidth = input(0);
|
||||
|
||||
/** Emits when the user presses the close button */
|
||||
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
|
||||
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
|
||||
@Output() onClose = new EventEmitter<void>();
|
||||
|
||||
protected get iconClass(): string {
|
||||
|
||||
@@ -17,12 +17,16 @@ import { ToastOptions, ToastService } from "./toast.service";
|
||||
const toastServiceExampleTemplate = `
|
||||
<button bitButton type="button" (click)="toastService.showToast(toastOptions)">Show Toast</button>
|
||||
`;
|
||||
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
|
||||
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
|
||||
@Component({
|
||||
selector: "toast-service-example",
|
||||
template: toastServiceExampleTemplate,
|
||||
imports: [ButtonModule],
|
||||
})
|
||||
export class ToastServiceExampleComponent {
|
||||
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
|
||||
// eslint-disable-next-line @angular-eslint/prefer-signals
|
||||
@Input()
|
||||
toastOptions?: ToastOptions;
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ import { ToastComponent } from "./toast.component";
|
||||
/**
|
||||
* Toasts are ephemeral notifications. They most often communicate the result of a user action. Due to their ephemeral nature, long messages and critical alerts should not utilize toasts.
|
||||
*/
|
||||
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
|
||||
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
|
||||
@Component({
|
||||
template: `
|
||||
<bit-toast
|
||||
|
||||
Reference in New Issue
Block a user