Skip to content

Commit 8b77b6e

Browse files
committed
Remove import decorator usage.
1 parent 7d02249 commit 8b77b6e

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

src/app/public/ngx-scroll-top.component.ts

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {
22
Component,
33
HostBinding,
44
HostListener,
5-
Input,
65
OnInit,
76
input,
87
signal,
@@ -56,7 +55,10 @@ export class NgxScrollTopComponent implements OnInit {
5655
*
5756
* Tip: Define any `'x'` css property available for `'color: x'`
5857
*/
59-
@Input() @HostBinding('style.color') public fontColor = '#FFFFFF';
58+
public readonly fontColor = input('#FFFFFF');
59+
@HostBinding('style.color') protected get hostFontColor(): string {
60+
return this.fontColor();
61+
}
6062

6163
/**
6264
* The font size for the nested content within the back to top button.
@@ -67,14 +69,20 @@ export class NgxScrollTopComponent implements OnInit {
6769
*
6870
* Tip: Define any `'x'` css property available for `'font-size: x'`
6971
*/
70-
@Input() @HostBinding('style.font-size') public fontSize = '16px';
72+
public readonly fontSize = input('16px');
73+
@HostBinding('style.font-size') protected get hostFontSize(): string {
74+
return this.fontSize();
75+
}
7176

7277
/**
7378
* Height of back to top button in string format.
7479
*
7580
* @example `'32px'` or `'2rem'`
7681
*/
77-
@Input() @HostBinding('style.height') public height = '40px';
82+
public readonly height = input('40px');
83+
@HostBinding('style.height') protected get hostHeight(): string {
84+
return this.height();
85+
}
7886

7987
/**
8088
* Position on-screen where the back to top button is displayed.
@@ -88,15 +96,21 @@ export class NgxScrollTopComponent implements OnInit {
8896
*
8997
* @example `'32px'` or `'2rem'`
9098
*/
91-
@Input() @HostBinding('style.width') public width = '40px';
99+
public readonly width = input('40px');
100+
@HostBinding('style.width') protected get hostWidth(): string {
101+
return this.width();
102+
}
92103

93104
/**
94105
* Style the `z-index` for the back to top button as needed for correct layer
95106
* height adjustment. This can be useful when working with sticky headers.
96107
*
97108
* Default: `999`
98109
*/
99-
@Input() @HostBinding('style.z-index') public zIndex = 999;
110+
public readonly zIndex = input(999);
111+
@HostBinding('style.z-index') protected get hostZIndex(): number {
112+
return this.zIndex();
113+
}
100114

101115
/**
102116
* Whether button should be rendered in DOM.
@@ -173,7 +187,7 @@ export class NgxScrollTopComponent implements OnInit {
173187
const bottomY = docEl.scrollHeight - docEl.clientHeight;
174188
const bottomOffset = parsePxStringToInt(this.bottomOffset());
175189
const distanceFromBottom = bottomY - scrollY;
176-
const halfHeight = parsePxStringToInt(this.height) / 2;
190+
const halfHeight = parsePxStringToInt(this.height()) / 2;
177191
const defaultPadding = parsePxStringToInt(this.defaultPadding);
178192

179193
if (distanceFromBottom + (halfHeight - defaultPadding) < bottomOffset) {

0 commit comments

Comments
 (0)