Skip to content

Commit 864c050

Browse files
committed
refactor(card): host class metadata, input signals
1 parent 4e4132c commit 864c050

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, HostBinding, Input } from '@angular/core';
1+
import { Component, HostBinding, input, InputSignal } from '@angular/core';
22
import { Colors, TextColors } from '../coreui.types';
33
import { TextBgColorDirective, TextColorDirective } from '../utilities';
44

@@ -9,36 +9,38 @@ import { TextBgColorDirective, TextColorDirective } from '../utilities';
99
hostDirectives: [
1010
{ directive: TextColorDirective, inputs: ['cTextColor: textColor'] },
1111
{ directive: TextBgColorDirective, inputs: ['cTextBgColor: textBgColor'] }
12-
]
12+
],
13+
host: {
14+
class: 'card'
15+
}
1316
})
1417
export class CardComponent {
15-
1618
/**
1719
* Sets the color context of the component to one of CoreUI’s themed colors.
1820
* @type Colors
1921
*/
20-
@Input() color?: Colors;
22+
readonly color: InputSignal<Colors | undefined> = input();
2123

2224
/**
2325
* Sets the text color context of the component to one of CoreUI’s themed colors.
2426
* via TextColorDirective
2527
* @type TextColors
2628
*/
27-
@Input() textColor?: TextColors;
29+
readonly textColor: InputSignal<TextColors | undefined> = input();
2830

2931
/**
30-
* Sets the component's color scheme to one of CoreUI's themed colors, ensuring the text color contrast adheres to the WCAG 4.5:1 contrast ratio standard for accessibility.
32+
* Sets the component's color scheme to one of CoreUI themed colors, ensuring the text color contrast adheres to the WCAG 4.5:1 contrast ratio standard for accessibility.
3133
* via TextBgColorDirective
3234
* @type Colors
3335
* @since 5.0.0
3436
*/
35-
@Input() textBgColor?: Colors;
37+
readonly textBgColor: InputSignal<Colors | undefined> = input();
3638

3739
@HostBinding('class')
3840
get hostClasses(): any {
3941
return {
4042
card: true,
41-
[`bg-${this.color}`]: !!this.color
43+
[`bg-${this.color()}`]: !!this.color()
4244
};
4345
}
4446
}

0 commit comments

Comments
 (0)