-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(kit): support
[label]
in tui-avatar-labeled
- Loading branch information
Showing
5 changed files
with
52 additions
and
18 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
23 changes: 9 additions & 14 deletions
23
projects/demo/src/modules/experimental/avatar/examples/6/index.html
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,34 +1,29 @@ | ||
<tui-avatar-labeled> | ||
<tui-avatar-labeled label="Grigori Constantinopolsky"> | ||
<tui-avatar | ||
[src]="'https://avatars.githubusercontent.com/u/10106368' | tuiFallbackSrc: 'tuiIconUserLarge' | async" | ||
></tui-avatar> | ||
|
||
<div tuiFade>MarsiBarsi</div> | ||
</tui-avatar-labeled> | ||
|
||
<tui-avatar-labeled> | ||
<tui-avatar-labeled label="Nikolai Rimsky-Korsakov"> | ||
<tui-avatar | ||
[src]="'https://avatars.githubusercontent.com/u/11832552' | tuiFallbackSrc: 'tuiIconUserLarge' | async" | ||
></tui-avatar> | ||
|
||
<div tuiFade>Inkin</div> | ||
<div tuiFade>Alexander</div> | ||
</tui-avatar-labeled> | ||
|
||
<tui-avatar-labeled> | ||
<tui-avatar-labeled label="Hubert Wolfflegelstainhausenbergedorf"> | ||
<tui-avatar | ||
[src]="'https://avatars.githubusercontent.com/u/46284632' | tuiFallbackSrc: 'tuiIconUserLarge' | async" | ||
></tui-avatar> | ||
|
||
<div tuiFade>Potekhin</div> | ||
<div tuiFade>Vladimir</div> | ||
</tui-avatar-labeled> | ||
|
||
<tui-avatar-labeled> | ||
<tui-avatar-labeled label="Arkhangelsky Constantine"> | ||
<tui-avatar | ||
[src]="'https://avatars.githubusercontent.com/u/35179038' | tuiFallbackSrc: 'tuiIconUserLarge' | async" | ||
></tui-avatar> | ||
</tui-avatar-labeled> | ||
|
||
<div tuiFade>Barsukov</div> | ||
<div tuiFade>Nikita</div> | ||
<tui-avatar-labeled label="Zoya Kosmodemyanskaya"> | ||
<tui-avatar | ||
[src]="'https://avatars.githubusercontent.com/u/8158578' | tuiFallbackSrc: 'tuiIconUserLarge' | async" | ||
></tui-avatar> | ||
</tui-avatar-labeled> |
32 changes: 29 additions & 3 deletions
32
projects/experimental/components/avatar-labeled/avatar-labeled.component.ts
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,10 +1,36 @@ | ||
import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core'; | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
HostBinding, | ||
Input, | ||
ViewEncapsulation, | ||
} from '@angular/core'; | ||
import {tuiPure} from '@taiga-ui/cdk'; | ||
|
||
@Component({ | ||
selector: 'tui-avatar-labeled', | ||
template: '<ng-content></ng-content>', | ||
template: ` | ||
<ng-content></ng-content> | ||
<ng-container *ngIf="label.length"> | ||
<span | ||
*ngFor="let item of split(label)" | ||
tuiFade | ||
> | ||
{{ item }} | ||
</span> | ||
</ng-container> | ||
`, | ||
styleUrls: ['./avatar-labeled.styles.less'], | ||
encapsulation: ViewEncapsulation.None, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class TuiAvatarLabeledComponent {} | ||
export class TuiAvatarLabeledComponent { | ||
@Input() | ||
@HostBinding('attr.title') | ||
label = ''; | ||
|
||
@tuiPure | ||
split(label: string): readonly string[] { | ||
return label.split(' '); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
projects/experimental/components/avatar-labeled/avatar-labeled.module.ts
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
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