11import { 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' ;
34
45@Component ( {
56 selector : 'c-badge' ,
67 template : '<ng-content></ng-content>' ,
7- standalone : true
8+ standalone : true ,
9+ hostDirectives : [ {
10+ directive : TextColorDirective , inputs : [ 'cTextColor: textColor' ]
11+ } ]
812} )
913export class BadgeComponent {
1014 /**
@@ -26,11 +30,13 @@ export class BadgeComponent {
2630 * Size the component small.
2731 */
2832 @Input ( ) size ?: 'sm' ;
33+
2934 /**
3035 * Sets the text color of the component to one of CoreUI’s themed colors.
36+ * via TextColorDirective
3137 * @type TextColors
3238 */
33- @Input ( ) textColor ?: string ;
39+ @Input ( ) textColor ?: TextColors ;
3440
3541 constructor ( ) { }
3642
@@ -48,7 +54,6 @@ export class BadgeComponent {
4854 return Object . assign ( {
4955 badge : true ,
5056 [ `bg-${ this . color } ` ] : ! ! this . color ,
51- [ `text-${ this . textColor } ` ] : ! ! this . textColor ,
5257 [ `badge-${ this . size } ` ] : ! ! this . size ,
5358 [ `${ this . shape } ` ] : ! ! this . shape
5459 } , ! ! this . position ? positionClasses : { }
0 commit comments