-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Expand file tree
/
Copy pathstatic-text.component.ts
More file actions
38 lines (34 loc) · 846 Bytes
/
Copy pathstatic-text.component.ts
File metadata and controls
38 lines (34 loc) · 846 Bytes
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
/* eslint-disable @angular-eslint/component-selector */
import { Component, computed, input } from '@angular/core';
import { TextComponent } from './text.component';
export type StaticTextType = 'normal' | 'warning' | 'error';
@Component({
selector: 'static-text',
imports: [TextComponent],
template: `
<text [font]="font()" [color]="color()">This is a static text</text>
`,
})
export class TextStaticComponent {
type = input<StaticTextType>('normal');
font = computed(() => {
switch (this.type()) {
case 'error':
return 30;
case 'warning':
return 25;
default:
return 10;
}
});
color = computed(() => {
switch (this.type()) {
case 'error':
return 'red';
case 'warning':
return 'orange';
default:
return 'black';
}
});
}