mirror of
https://github.com/bitwarden/browser
synced 2025-12-25 12:43:36 +00:00
25 lines
525 B
TypeScript
25 lines
525 B
TypeScript
import { Component, HostBinding, Input } from "@angular/core";
|
|
import { DomSanitizer } from "@angular/platform-browser";
|
|
|
|
import { Icon, isIcon } from "./icon";
|
|
|
|
@Component({
|
|
selector: "bit-icon",
|
|
template: ``,
|
|
})
|
|
export class BitIconComponent {
|
|
@Input() icon: Icon;
|
|
|
|
@HostBinding()
|
|
protected get innerHtml() {
|
|
if (!isIcon(this.icon)) {
|
|
return "";
|
|
}
|
|
|
|
const svg = this.icon.svg;
|
|
return this.domSanitizer.bypassSecurityTrustHtml(svg);
|
|
}
|
|
|
|
constructor(private domSanitizer: DomSanitizer) {}
|
|
}
|