1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00
Files
browser/libs/components/src/icon/icon.component.ts
Oscar Hinton 5a582dfc6f [CL-135] Migrate component library to standalone components (#12389)
* Migrate component library to standalone components

* Fix tests
2024-12-17 17:29:48 -05:00

28 lines
675 B
TypeScript

// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { Component, HostBinding, Input } from "@angular/core";
import { DomSanitizer, SafeHtml } from "@angular/platform-browser";
import { Icon, isIcon } from "./icon";
@Component({
selector: "bit-icon",
template: ``,
standalone: true,
})
export class BitIconComponent {
@Input() set icon(icon: Icon) {
if (!isIcon(icon)) {
this.innerHtml = "";
return;
}
const svg = icon.svg;
this.innerHtml = this.domSanitizer.bypassSecurityTrustHtml(svg);
}
@HostBinding() innerHtml: SafeHtml;
constructor(private domSanitizer: DomSanitizer) {}
}