coreui-angular-ex
Version:
CoreUI Components Library for Angular
69 lines (63 loc) • 1.76 kB
text/typescript
import { Component, HostBinding, Input } from '@angular/core';
import { NgClass, NgIf, NgTemplateOutlet } from '@angular/common';
import { Colors, Shapes, Sizes, TextColors } from '../coreui.types';
export class AvatarComponent {
/**
* Sets the background color context of the component to one of CoreUI’s themed colors.
* @type Colors
*/
color?: Colors;
/**
* Select the shape of the component.
* @type Shapes
*/
shape?: Shapes;
/**
* Size the component small, large, or extra large.
* @default 'md'
*/
size?: Omit<Sizes, 'xxl'> = 'md';
/**
* The src attribute for the img element.
* @type string
*/
src?: string;
/**
* Sets the color context of the status indicator to one of CoreUI’s themed colors.
* @type Colors
*/
status?: Colors;
/**
* Sets the text color of the component to one of CoreUI’s themed colors.
*
* @values 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | 'white' | 'muted' | string
*/
textColor?: TextColors;
constructor() { }
get statusClass(): any {
return {
'avatar-status': true,
[`bg-${this.status}`]: !!this.status
};
}
get hostClasses(): any {
return {
avatar: true,
[`avatar-${this.size}`]: !!this.size,
[`bg-${this.color}`]: !!this.color,
[`${this.shape}`]: !!this.shape,
[`text-${this.textColor}`]: !!this.textColor
};
}
}