-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework the avatar template to use templates. Remove unnecessary root …
…div element. #136
- Loading branch information
Borislav Kulov
committed
Feb 9, 2018
1 parent
75fb610
commit 794fa17
Showing
2 changed files
with
43 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
<div class="igx-avatar igx-avatar--{{size}}" aria-label="avatar" role="img"> | ||
<img #image *ngIf="src" src="{{src}}" class="igx-avatar--image igx-avatar--{{size}}" [class.igx-avatar--rounded]="isRounded" | ||
[style.backgroundColor]="bgColor" [attr.aria-roledescription]="roleDescription" /> | ||
<svg #initialsImage *ngIf="initials && !src" xmlns="http://www.w3.org/2000/svg" [class.igx-avatar--rounded]="isRounded" [style.backgroundColor]="bgColor" | ||
[attr.aria-roledescription]="roleDescription"> | ||
<text text-anchor="middle" /> | ||
</svg> | ||
<span *ngIf="!src && !initials" class="igx-avatar--{{size}} igx-avatar--icon" [class.igx-avatar--rounded]="isRounded" [style.backgroundColor]="bgColor" | ||
<ng-template #imageTemplate> | ||
<img #image src="{{src}}" class="igx-avatar--image igx-avatar--{{size}}" [class.igx-avatar--rounded]="isRounded" [style.backgroundColor]="bgColor" | ||
[attr.aria-roledescription]="roleDescription" /> | ||
</ng-template> | ||
|
||
<ng-template #initialsTemplate> | ||
<svg #initialsImage xmlns="http://www.w3.org/2000/svg" [class.igx-avatar--rounded]="isRounded" [style.backgroundColor]="bgColor" | ||
[attr.aria-roledescription]="roleDescription"> | ||
<text text-anchor="middle" /> | ||
</svg> | ||
</ng-template> | ||
|
||
<ng-template #iconTemplate> | ||
<span class="igx-avatar--{{size}} igx-avatar--icon" [class.igx-avatar--rounded]="isRounded" [style.backgroundColor]="bgColor" | ||
[style.color]="color" [attr.aria-roledescription]="roleDescription"> | ||
<igx-icon fontSet="material" [name]="icon"></igx-icon> | ||
</span> | ||
<ng-content></ng-content> | ||
</div> | ||
</ng-template> | ||
|
||
<ng-container *ngTemplateOutlet="template"></ng-container> | ||
<ng-content></ng-content> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters