@marcj/angular-desktop-ui
Version:
library offering you desktop UI widgets in Angular 7+
91 lines (74 loc) • 2.02 kB
text/typescript
import {Component, HostBinding, Input, OnChanges, OnInit} from '@angular/core';
export class IconComponent implements OnInit, OnChanges {
/**
* The icon for this button. Either a icon name same as for dui-icon, or an image path.
*/
name?: string;
/**
* Change in the icon size. Should not be necessary usually.
*/
size?: number;
clickable: boolean | '' = false;
color?: string;
public usedSize = 17;
get isClickable() {
return false !== this.clickable;
}
disabled: boolean = false;
get isDisabled() {
return false !== this.disabled;
}
constructor() {
}
ngOnChanges(): void {
if (this.size) {
this.usedSize = this.size;
}
if (!this.size && this.name) {
const pos = this.name.indexOf('_');
if (pos !== -1) {
const potentialNumber = parseInt(this.name.slice(0, pos), 10);
if (potentialNumber) {
this.usedSize = potentialNumber;
}
}
}
}
ngOnInit() {
}
}