Skip to content

Commit 47dcd83

Browse files
committed
refactor(input-group): input signals, host bindings
1 parent 28f5485 commit 47dcd83

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import { Component, HostBinding, Input } from '@angular/core';
1+
import { Component, computed, input } from '@angular/core';
22

33
@Component({
44
selector: 'c-input-group',
55
template: '<ng-content />',
66
standalone: true,
7-
host: { class: 'input-group' }
7+
host: { class: 'input-group', '[class]': 'hostClasses()' }
88
})
99
export class InputGroupComponent {
1010
/**
1111
* Size the component small or large.
1212
*/
13-
@Input() sizing: string | 'sm' | 'lg' | '' = '';
13+
readonly sizing = input<string | 'sm' | 'lg' | ''>('');
1414

15-
@HostBinding('class')
16-
get hostClasses(): any {
15+
readonly hostClasses = computed(() => {
16+
const sizing = this.sizing();
1717
return {
1818
'input-group': true,
19-
[`input-group-${this.sizing}`]: !!this.sizing
20-
};
21-
}
19+
[`input-group-${sizing}`]: !!sizing
20+
} as Record<string, boolean>;
21+
});
2222
}

0 commit comments

Comments
 (0)