File tree 1 file changed +12
-11
lines changed
1 file changed +12
-11
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 , InputSignal } from '@angular/core' ;
2
2
3
3
import { Positions } from '../coreui.types' ;
4
4
5
5
@Component ( {
6
6
selector : 'c-footer, [cFooter]' ,
7
7
template : '<ng-content />' ,
8
8
standalone : true ,
9
- host : { class : 'footer' }
9
+ host : {
10
+ class : 'footer' ,
11
+ '[class]' : 'hostClasses()' ,
12
+ '[attr.role]' : 'role()'
13
+ }
10
14
} )
11
15
export class FooterComponent {
12
16
/**
13
17
* Place footer in non-static positions. [docs]
14
18
* @type Positions
15
19
*/
16
- @ Input ( ) position ?: Positions ;
20
+ readonly position : InputSignal < Positions | undefined > = input ( ) ;
17
21
18
22
/**
19
23
* Default role for footer. [docs]
20
24
* @type string
21
25
* @default 'contentinfo'
22
26
*/
23
- @HostBinding ( 'attr.role' )
24
- @Input ( )
25
- role = 'contentinfo' ;
27
+ readonly role : InputSignal < string > = input ( 'contentinfo' ) ;
26
28
27
- @HostBinding ( 'class' )
28
- get getClasses ( ) : any {
29
+ readonly hostClasses = computed ( ( ) => {
29
30
return {
30
31
footer : true ,
31
- [ `footer-${ this . position } ` ] : ! ! this . position
32
- } ;
33
- }
32
+ [ `footer-${ this . position ( ) } ` ] : ! ! this . position ( )
33
+ } as Record < string , boolean > ;
34
+ } ) ;
34
35
}
You can’t perform that action at this time.
0 commit comments