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' ;
22import { Colors } from '../coreui.types' ;
33
44@Component ( {
55 selector : 'c-callout, [cCallout]' ,
66 template : '<ng-content />' ,
77 styleUrls : [ './callout.component.scss' ] ,
88 standalone : true ,
9- host : { class : 'callout' }
9+ host : { class : 'callout' , '[class]' : 'hostClasses()' }
1010} )
1111export class CalloutComponent {
1212 /**
1313 * Sets the color context of the component to one of CoreUI’s themed colors.
1414 * @type Colors
1515 */
16- @ Input ( ) color ?: Colors ;
16+ readonly color = input < Colors > ( ) ;
1717
18- @ HostBinding ( 'class' )
19- get hostClasses ( ) : any {
18+ readonly hostClasses = computed ( ( ) => {
19+ const color = this . color ( ) ;
2020 return {
2121 callout : true ,
22- [ `callout-${ this . color } ` ] : ! ! this . color
23- } ;
24- }
22+ [ `callout-${ color } ` ] : ! ! color
23+ } as Record < string , boolean > ;
24+ } ) ;
2525}
You can’t perform that action at this time.
0 commit comments