mirror of
https://github.com/bitwarden/browser.git
synced 2024-10-30 08:10:34 +01:00
9d4d340930
* remove innerHTML getter; update tests * remove template; use hostbinding
25 lines
561 B
TypeScript
25 lines
561 B
TypeScript
import { Component, HostBinding, Input } from "@angular/core";
|
|
import { DomSanitizer, SafeHtml } from "@angular/platform-browser";
|
|
|
|
import { Icon, isIcon } from "./icon";
|
|
|
|
@Component({
|
|
selector: "bit-icon",
|
|
template: ``,
|
|
})
|
|
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) {}
|
|
}
|