import { Component, ElementRef, Input, OnChanges, ViewChild } from '@angular/core';
import { AnnotationIconType } from '@red/domain';

@Component({
    selector: 'redaction-annotation-icon [color] [type] [label]',
    templateUrl: './annotation-icon.component.html',
    styleUrls: ['./annotation-icon.component.scss'],
})
export class AnnotationIconComponent implements OnChanges {
    @Input() color: string;
    @Input() type: AnnotationIconType;
    @Input() label: string;

    @ViewChild('icon', { static: true }) icon: ElementRef;

    ngOnChanges() {
        this.icon.nativeElement.style.setProperty('--color', this.color);
    }
}
