1
1
import { Component , HostBinding , Input } from '@angular/core' ;
2
- import { BadgePositions , Colors , Shapes } from '../coreui.types' ;
2
+ import { BadgePositions , Colors , Shapes , TextColors } from '../coreui.types' ;
3
+ import { TextColorDirective } from '../utilities' ;
3
4
4
5
@Component ( {
5
6
selector : 'c-badge' ,
6
7
template : '<ng-content></ng-content>' ,
7
- standalone : true
8
+ standalone : true ,
9
+ hostDirectives : [ {
10
+ directive : TextColorDirective , inputs : [ 'cTextColor: textColor' ]
11
+ } ]
8
12
} )
9
13
export class BadgeComponent {
10
14
/**
@@ -26,11 +30,13 @@ export class BadgeComponent {
26
30
* Size the component small.
27
31
*/
28
32
@Input ( ) size ?: 'sm' ;
33
+
29
34
/**
30
35
* Sets the text color of the component to one of CoreUI’s themed colors.
36
+ * via TextColorDirective
31
37
* @type TextColors
32
38
*/
33
- @Input ( ) textColor ?: string ;
39
+ @Input ( ) textColor ?: TextColors ;
34
40
35
41
constructor ( ) { }
36
42
@@ -48,7 +54,6 @@ export class BadgeComponent {
48
54
return Object . assign ( {
49
55
badge : true ,
50
56
[ `bg-${ this . color } ` ] : ! ! this . color ,
51
- [ `text-${ this . textColor } ` ] : ! ! this . textColor ,
52
57
[ `badge-${ this . size } ` ] : ! ! this . size ,
53
58
[ `${ this . shape } ` ] : ! ! this . shape
54
59
} , ! ! this . position ? positionClasses : { }
0 commit comments