mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 01:33:33 +00:00
UIF - Prefer signal & change detection (#16940)
This commit is contained in:
@@ -24,7 +24,7 @@ export class DrawerHeaderComponent {
|
||||
/**
|
||||
* The title to display
|
||||
*/
|
||||
title = input.required<string>();
|
||||
readonly title = input.required<string>();
|
||||
|
||||
/** We don't want to set the HTML title attribute with `this.title` */
|
||||
@HostBinding("attr.title")
|
||||
|
||||
@@ -10,7 +10,7 @@ import { Directive, signal } from "@angular/core";
|
||||
selector: "[bitDrawerHost]",
|
||||
})
|
||||
export class DrawerHostDirective {
|
||||
private _portal = signal<Portal<unknown> | undefined>(undefined);
|
||||
private readonly _portal = signal<Portal<unknown> | undefined>(undefined);
|
||||
|
||||
/** The portal to display */
|
||||
portal = this._portal.asReadonly();
|
||||
|
||||
@@ -25,7 +25,7 @@ import { DrawerService } from "./drawer.service";
|
||||
})
|
||||
export class DrawerComponent {
|
||||
private drawerHost = inject(DrawerService);
|
||||
private portal = viewChild.required(CdkPortal);
|
||||
private readonly portal = viewChild.required(CdkPortal);
|
||||
|
||||
/**
|
||||
* Whether or not the drawer is open.
|
||||
@@ -33,7 +33,7 @@ export class DrawerComponent {
|
||||
* Note: Does not support implicit boolean transform due to Angular limitation. Must be bound explicitly `[open]="true"` instead of just `open`.
|
||||
* https://github.com/angular/angular/issues/55166#issuecomment-2032150999
|
||||
**/
|
||||
open = model<boolean>(false);
|
||||
readonly open = model<boolean>(false);
|
||||
|
||||
/**
|
||||
* The ARIA role of the drawer.
|
||||
@@ -43,7 +43,7 @@ export class DrawerComponent {
|
||||
* - [navigation](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/navigation_role)
|
||||
* - For drawers that primary contain links to other content.
|
||||
*/
|
||||
role = input<"complementary" | "navigation">("complementary");
|
||||
readonly role = input<"complementary" | "navigation">("complementary");
|
||||
|
||||
constructor() {
|
||||
effect(
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Injectable, signal } from "@angular/core";
|
||||
|
||||
@Injectable({ providedIn: "root" })
|
||||
export class DrawerService {
|
||||
private _portal = signal<Portal<unknown> | undefined>(undefined);
|
||||
private readonly _portal = signal<Portal<unknown> | undefined>(undefined);
|
||||
|
||||
/** The portal to display */
|
||||
portal = this._portal.asReadonly();
|
||||
|
||||
Reference in New Issue
Block a user