1
1
import { NgClass , NgOptimizedImage } from '@angular/common' ;
2
- import { Component , computed , HostBinding , input , InputSignal } from '@angular/core' ;
2
+ import { Component , computed , input , InputSignal } from '@angular/core' ;
3
3
4
4
import { Colors , Shapes , Sizes , TextColors } from '../coreui.types' ;
5
5
import { TextColorDirective } from '../utilities' ;
@@ -15,7 +15,7 @@ import { TextColorDirective } from '../utilities';
15
15
inputs : [ 'cTextColor: textColor' ]
16
16
}
17
17
] ,
18
- host : { class : 'avatar' }
18
+ host : { class : 'avatar' , '[class]' : 'hostClasses()' }
19
19
} )
20
20
export class AvatarComponent {
21
21
/**
@@ -65,16 +65,15 @@ export class AvatarComponent {
65
65
return {
66
66
'avatar-status' : true ,
67
67
[ `bg-${ this . status ( ) } ` ] : ! ! this . status ( )
68
- } ;
68
+ } as Record < string , boolean > ;
69
69
} ) ;
70
70
71
- @HostBinding ( 'class' )
72
- get hostClasses ( ) : any {
71
+ readonly hostClasses = computed ( ( ) => {
73
72
return {
74
73
avatar : true ,
75
74
[ `avatar-${ this . size ( ) } ` ] : ! ! this . size ( ) ,
76
75
[ `bg-${ this . color ( ) } ` ] : ! ! this . color ( ) ,
77
76
[ `${ this . shape ( ) } ` ] : ! ! this . shape ( )
78
- } ;
79
- }
77
+ } as Record < string , boolean > ;
78
+ } ) ;
80
79
}
0 commit comments