1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00
Files
browser/libs/vault/src/components/org-icon.directive.ts
Oscar Hinton f3ff1e98ec Remove standalone true from vault (#15040)
Remove standalone: true from every instance since it's the default as of Angular 19.
2025-06-02 13:22:57 -07:00

50 lines
1.2 KiB
TypeScript

import { Directive, ElementRef, HostBinding, Input, Renderer2 } from "@angular/core";
import { ProductTierType } from "@bitwarden/common/billing/enums";
export type OrgIconSize = "default" | "small" | "large";
@Directive({
selector: "[appOrgIcon]",
})
export class OrgIconDirective {
@Input({ required: true }) tierType!: ProductTierType;
@Input() size?: OrgIconSize = "default";
constructor(
private el: ElementRef,
private renderer: Renderer2,
) {
this.renderer.setAttribute(this.el.nativeElement, "aria-hidden", "true");
}
get iconSize(): "bwi-sm" | "bwi-lg" | "" {
switch (this.size) {
case "small":
return "bwi-sm";
case "large":
return "bwi-lg";
default:
return "";
}
}
get orgIcon(): string {
switch (this.tierType) {
case ProductTierType.Free:
case ProductTierType.Families:
return "bwi-family";
case ProductTierType.Teams:
case ProductTierType.Enterprise:
case ProductTierType.TeamsStarter:
return "bwi-business";
default:
return "";
}
}
@HostBinding("class") get classList() {
return ["bwi", this.iconSize, this.orgIcon];
}
}