Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(kit): support [label] in tui-avatar-labeled #6921

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@
"replicants",
"tuiiconbutton",
"hitbox",
"viewports"
"viewports",
"Grigori",
"Constantinopolsky",
"Rimsky",
"Korsakov",
"Wolfflegelstainhausenbergedorf",
"Arkhangelsky",
"Zoya",
"Kosmodemyanskaya"
],
"ignoreRegExpList": ["\\(https?://.*?\\)", "\\/{1}.+\\/{1}", "\\%2F.+", "\\%2C.+", "\\ɵ.+", "\\ыва.+"],
"overrides": [
Expand Down
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>
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(' ');
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
// eslint-disable-next-line @taiga-ui/experience/no-deep-imports
import {TuiFadeModule} from '@taiga-ui/experimental/directives/fade';

import {TuiAvatarLabeledComponent} from './avatar-labeled.component';

@NgModule({
imports: [CommonModule, TuiFadeModule],
declarations: [TuiAvatarLabeledComponent],
exports: [TuiAvatarLabeledComponent],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ tui-avatar-labeled {
line-height: 0.895rem;
font-size: 0.75rem;
padding: 0 0.5rem;
white-space: nowrap;

tui-avatar {
margin-bottom: 0.375rem;
Expand Down
Loading