Skip to content

Commit c03d5c1

Browse files
committed
refactor(avatar): add CUSTOM enumeration member to replace DEFAULT
1 parent d0e2269 commit c03d5c1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

projects/igniteui-angular/src/lib/avatar/avatar.component.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export enum IgxAvatarSize {
2323
export enum IgxAvatarType {
2424
INITIALS = 'initials',
2525
IMAGE = 'image',
26-
ICON = 'icon'
26+
ICON = 'icon',
27+
CUSTOM = 'custom',
2728
}
2829

2930
/**
@@ -117,15 +118,18 @@ export class IgxAvatarComponent implements OnInit, AfterViewInit {
117118

118119
/**
119120
* Returns the type of the avatar.
120-
* The avatar can be: `"initials type avatar"`, `"icon type avatar"` or `"image type avatar"`.
121+
* The avatar can be:
122+
* - `"initials type avatar"`
123+
* - `"icon type avatar"`
124+
* - `"image type avatar"`.
125+
* - `"custom type avatar"`.
121126
*
122127
* ```typescript
123128
* let avatarDescription = this.avatar.roleDescription;
124129
* ```
125130
*
126131
* @memberof IgxAvatarComponent
127132
*/
128-
129133
@HostBinding('attr.aria-roledescription')
130134
public roleDescription: string;
131135

@@ -283,6 +287,8 @@ export class IgxAvatarComponent implements OnInit, AfterViewInit {
283287
if (this.initials) {
284288
return IgxAvatarType.INITIALS;
285289
}
290+
291+
return IgxAvatarType.CUSTOM;
286292
}
287293

288294
/**
@@ -320,7 +326,7 @@ export class IgxAvatarComponent implements OnInit, AfterViewInit {
320326
*@hidden
321327
*/
322328
public ngAfterViewInit() {
323-
if (this.type) {
329+
if (this.type !== IgxAvatarType.CUSTOM) {
324330
this.elementRef.nativeElement.classList.add(`igx-avatar--${this.type}`);
325331
}
326332

0 commit comments

Comments
 (0)