import { Component, OnInit, Input, ViewChild, ElementRef, AfterViewInit, } from '@angular/core'; import { PpIcon, PpIconType } from './icon.type'; @Component({ selector: 'pp-icon', templateUrl: './icon.component.html', styleUrls: ['./icon.component.scss'], }) export class PpIconComponent implements OnInit, AfterViewInit { // Icon element for changing css @ViewChild('iconContent', { static: false }) iconContent!: ElementRef; @Input() iconConfig!: PpIcon; CanIconType = PpIconType; constructor() {} ngOnInit() {} ngAfterViewInit() { if (this.iconConfig && this.iconConfig.color && this.iconContent) { this.iconContent.nativeElement.style.color = this.iconConfig.color; } else { this.iconContent.nativeElement.style.color = '#212121'; } } }