This commit is contained in:
Chris Chen
2025-11-04 12:42:10 -08:00
parent b8b35645ac
commit 46ec236ed5
11 changed files with 335 additions and 92 deletions
@@ -1 +1 @@
<span class="MD2Icon {{iconName}} {{iconClass}} {{sizeClass}}"></span>
<span [innerHtml]="iconHtml" class="g-font-size-20 g-line-height-0 mx-2"></span>
@@ -1,5 +1,6 @@
import { Component, Input, OnInit } from '@angular/core';
import { MD2Icon } from '../massive-darkness2.model';
import { MD2StateService } from '../../../services/MD2/md2-state.service';
@Component({
selector: 'md2-icon',
@@ -10,13 +11,17 @@ export class MD2IconComponent implements OnInit {
@Input() iconClass: string = 'mr-1';
iconHtml: string;
private _icon: string | MD2Icon;
@Input() public set icon(v: string | MD2Icon) {
if (this._icon != v) {
this._icon = v;
//if it's string, convert it to MD2Icon
if (typeof v === 'string') {
v = MD2Icon[v];
}
this.iconHtml = this.md2StateService.iconHtml(v as MD2Icon);
}
if (this.isMD2Icon(v)) {
this.iconName = MD2Icon[v].toLowerCase();
@@ -30,7 +35,7 @@ export class MD2IconComponent implements OnInit {
}
@Input() size: string = 'sm';
iconName: string;
constructor() { }
constructor(private md2StateService: MD2StateService) { }
ngOnInit(): void {
}