File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
projects/coreui-angular/src/lib/callout Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 1
- import { Component , HostBinding , Input } from '@angular/core' ;
1
+ import { Component , computed , input } from '@angular/core' ;
2
2
import { Colors } from '../coreui.types' ;
3
3
4
4
@Component ( {
5
5
selector : 'c-callout, [cCallout]' ,
6
6
template : '<ng-content />' ,
7
7
styleUrls : [ './callout.component.scss' ] ,
8
8
standalone : true ,
9
- host : { class : 'callout' }
9
+ host : { class : 'callout' , '[class]' : 'hostClasses()' }
10
10
} )
11
11
export class CalloutComponent {
12
12
/**
13
13
* Sets the color context of the component to one of CoreUI’s themed colors.
14
14
* @type Colors
15
15
*/
16
- @ Input ( ) color ?: Colors ;
16
+ readonly color = input < Colors > ( ) ;
17
17
18
- @ HostBinding ( 'class' )
19
- get hostClasses ( ) : any {
18
+ readonly hostClasses = computed ( ( ) => {
19
+ const color = this . color ( ) ;
20
20
return {
21
21
callout : true ,
22
- [ `callout-${ this . color } ` ] : ! ! this . color
23
- } ;
24
- }
22
+ [ `callout-${ color } ` ] : ! ! color
23
+ } as Record < string , boolean > ;
24
+ } ) ;
25
25
}
You can’t perform that action at this time.
0 commit comments