mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
[EC-512] Tree shakeable icons (#3427)
* [EC-512] feat: create new icon class * [EC-512] feat: implement protected svgIcon function * [EC-512] feat: use new icon class in component * [EC-512] feat: integrate new icons in application * [EC-512] fix: linting * [EC-512] chore: move report icons to where they are used * [EC-512] chore: add export type explanation
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Component, HostBinding, Input } from "@angular/core";
|
||||
import { DomSanitizer } from "@angular/platform-browser";
|
||||
|
||||
import { Icon, IconSvg } from "./icons";
|
||||
import { Icon, isIcon } from "./icon";
|
||||
|
||||
@Component({
|
||||
selector: "bit-icon",
|
||||
@@ -14,11 +14,11 @@ export class BitIconComponent {
|
||||
|
||||
@HostBinding("innerHtml")
|
||||
protected get innerHtml() {
|
||||
const svg = IconSvg[this.icon];
|
||||
if (svg == null) {
|
||||
return "Unknown icon";
|
||||
if (!isIcon(this.icon)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return this.domSanitizer.bypassSecurityTrustHtml(IconSvg[this.icon]);
|
||||
const svg = this.icon.svg;
|
||||
return this.domSanitizer.bypassSecurityTrustHtml(svg);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user