mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
[PM-9638] Browser V2 Item Details Defects (#10124)
* Item Details Refactored. Created OrgIcon directive, Added screen reader logic, removed excess styling.
This commit is contained in:
50
libs/vault/src/components/org-icon.directive.ts
Normal file
50
libs/vault/src/components/org-icon.directive.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { Directive, ElementRef, HostBinding, Input, Renderer2 } from "@angular/core";
|
||||
|
||||
import { ProductTierType } from "@bitwarden/common/billing/enums";
|
||||
|
||||
export type OrgIconSize = "default" | "small" | "large";
|
||||
|
||||
@Directive({
|
||||
standalone: true,
|
||||
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];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user