@engie-group/fluid-design-system-angular
Version:
Fluid Design System Angular
46 lines (38 loc) • 1.19 kB
text/typescript
import {CommonModule} from '@angular/common';
import {ChangeDetectionStrategy, Component, Input, ViewEncapsulation} from '@angular/core';
export class IconBaseComponent {
private MATERIAL_ICON_CLASS = 'material-icons';
protected ICON_CLASS = 'nj-icon';
/**
* @ignore
*/
isEngieIcon = false; //Fixme: Should be inferred by dependency tree. Not being set by input
/**
* Icon name
*/
name: string;
/**
* Text alternative for assistive technologies.
* @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label
*/
ariaLabel: string;
/**
* Icon additional class
*/
className: string;
protected getIconClass(): string {
if (this.isEngieIcon && !this.name) {
return '';
}
return this.isEngieIcon ? `${this.ICON_CLASS} ${this.ICON_CLASS}-${this.name}` : this.MATERIAL_ICON_CLASS;
}
}