import {OnInit, ElementRef, Input, Component, ViewEncapsulation} from "@angular/core";
import {NgClass} from "@angular/common";

/**
 * Created by jd on 24/02/2016.
 */

@Component(
    {
        selector: 'core-icon',
        templateUrl: "node_modules/bia-framework/components/core-icon/core-icon.template.html",
        styleUrls: ['node_modules/bia-framework/components/core-icon/core-icon.css'],
        encapsulation: ViewEncapsulation.None,
        directives: [NgClass]
    }
)
export class CoreIcon implements OnInit
{

    @Input()
    source:string;

    @Input()
    size:string;

    @Input()
    color:string;
    
    templateString:string;
    iClass:string;


    @Input()
    selectable:boolean;


    constructor(private element:ElementRef)
    {
    }


    ngOnInit():any
    {
        var selectableClass = this.selectable==true ? " selectable " : "";
        this.iClass = "icon--color-" + this.color + " icon-size-" + this.size + selectableClass ;
        this.source = this.source || "adb";
        this.templateString = "img/icons/" + this.source + ".svg#" + this.source;
        return undefined;
    }

}