-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(kit):
AvatarOutline
add new directive (#7087)
- Loading branch information
Showing
26 changed files
with
146 additions
and
111 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
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
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
Empty file.
Empty file.
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: 23 additions & 0 deletions
23
projects/demo/src/modules/components/avatar/examples/7/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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<tui-avatar | ||
size="m" | ||
src="tuiIconHeart" | ||
tuiAvatarOutline | ||
/> | ||
|
||
<tui-avatar | ||
size="l" | ||
tuiAvatarOutline="var(--tui-accent)" | ||
> | ||
<img | ||
alt="Alex Inkin" | ||
src="/assets/images/avatar.jpg" | ||
/> | ||
</tui-avatar> | ||
|
||
<tui-avatar | ||
size="xl" | ||
src="OK" | ||
tuiAvatarOutline="linear-gradient(#c86dd7, #3023ae)" | ||
[style.background]="'linear-gradient(#3023ae, #c86dd7)'" | ||
[style.color]="'#fff'" | ||
/> |
4 changes: 4 additions & 0 deletions
4
projects/demo/src/modules/components/avatar/examples/7/index.less
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
:host { | ||
display: flex; | ||
gap: 1rem; | ||
} |
14 changes: 14 additions & 0 deletions
14
projects/demo/src/modules/components/avatar/examples/7/index.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import {Component} from '@angular/core'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
import {TuiAvatarComponent, TuiAvatarOutlineDirective} from '@taiga-ui/kit'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [TuiAvatarComponent, TuiAvatarOutlineDirective], | ||
templateUrl: './index.html', | ||
styleUrls: ['./index.less'], | ||
encapsulation, | ||
changeDetection, | ||
}) | ||
export default class ExampleComponent {} |
File renamed without changes.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
projects/kit/components/avatar/avatar-outline.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core'; | ||
|
||
@Component({ | ||
standalone: true, | ||
template: '', | ||
styleUrls: ['./avatar-outline.styles.less'], | ||
encapsulation: ViewEncapsulation.None, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
host: { | ||
class: 'tui-avatar-outline', | ||
}, | ||
}) | ||
export class TuiAvatarOutlineComponent {} |
25 changes: 25 additions & 0 deletions
25
projects/kit/components/avatar/avatar-outline.directive.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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {Directive, Input} from '@angular/core'; | ||
import {tuiWithStyles} from '@taiga-ui/cdk'; | ||
|
||
import {TuiAvatarOutlineComponent} from './avatar-outline.component'; | ||
|
||
@Directive({ | ||
standalone: true, | ||
selector: '[tuiAvatarOutline]', | ||
host: { | ||
'[style.--t-fill]': 'value', | ||
'[class._outline]': 'value', | ||
}, | ||
}) | ||
export class TuiAvatarOutlineDirective { | ||
@Input() | ||
public tuiAvatarOutline: string | null = ''; | ||
|
||
protected readonly nothing = tuiWithStyles(TuiAvatarOutlineComponent); | ||
|
||
protected get value(): string | null { | ||
return this.tuiAvatarOutline === '' | ||
? 'var(--tui-primary)' | ||
: this.tuiAvatarOutline; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
@import '@taiga-ui/core/styles/taiga-ui-local'; | ||
|
||
[tuiAvatarOutline] { | ||
--t-outline: 0.1875rem; | ||
--t-gap: 0.125rem; | ||
|
||
&[data-size='xs'], | ||
&[data-size='s'], | ||
&[data-size='m'] { | ||
--t-outline: 0.125rem; | ||
--t-gap: 0.0625rem; | ||
} | ||
|
||
&._outline { | ||
mask: radial-gradient( | ||
closest-side, | ||
#000, | ||
#000 calc(100% - var(--t-gap) - var(--t-outline) - 0.5px), | ||
transparent calc(100% - var(--t-gap) - var(--t-outline)), | ||
transparent calc(100% - var(--t-outline) - 0.5px), | ||
#000 calc(100% - var(--t-outline)) | ||
); | ||
|
||
&:after { | ||
content: ''; | ||
.fullsize(); | ||
|
||
background: var(--t-fill); | ||
mask: radial-gradient( | ||
closest-side, | ||
transparent, | ||
transparent calc(100% - var(--t-outline) - 0.5px), | ||
#000 calc(100% - var(--t-outline)) | ||
); | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
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,2 +1,6 @@ | ||
export * from './avatar.component'; | ||
export * from './avatar.options'; | ||
export * from './avatar-labeled.component'; | ||
export * from './avatar-outline.component'; | ||
export * from './avatar-outline.directive'; | ||
export * from './avatar-stack.component'; |
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