-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathselectable-avatar.component.ts
54 lines (51 loc) · 1.26 KB
/
selectable-avatar.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { Component, EventEmitter, Input, Output } from "@angular/core";
@Component({
selector: "selectable-avatar",
template: `<span
[title]="title"
(click)="onFire()"
(keyup.enter)="onFire()"
tabindex="0"
[ngClass]="classList"
>
<bit-avatar
appStopClick
[text]="text"
size="xlarge"
[text]="text"
[color]="color"
[border]="false"
[id]="id"
[border]="border"
[title]="title"
>
</bit-avatar>
</span>`,
})
export class SelectableAvatarComponent {
@Input() id: string;
@Input() text: string;
@Input() title: string;
@Input() color: string;
@Input() border = false;
@Input() selected = false;
@Output() select = new EventEmitter<string>();
onFire() {
this.select.emit(this.color);
}
get classList() {
return ["tw-rounded-full tw-inline-block"]
.concat(["tw-cursor-pointer", "tw-outline", "tw-outline-solid", "tw-outline-offset-1"])
.concat(
this.selected
? ["tw-outline-[3px]", "tw-outline-primary-500"]
: [
"tw-outline-0",
"hover:tw-outline-1",
"hover:tw-outline-primary-300",
"focus:tw-outline-2",
"focus:tw-outline-primary-500",
]
);
}
}