From 929aa58034b141e75c3ac8aed2c0a11ad47bf193 Mon Sep 17 00:00:00 2001 From: sk0618054 Date: Sun, 10 Mar 2024 17:27:08 +0530 Subject: [PATCH] To correct github star numbers Signed-off-by: sk0618054 --- components/utils/countingNumbers.tsx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/components/utils/countingNumbers.tsx b/components/utils/countingNumbers.tsx index c59ed52c..7cc85f19 100644 --- a/components/utils/countingNumbers.tsx +++ b/components/utils/countingNumbers.tsx @@ -16,12 +16,10 @@ export default function CountingNumbers({ interval?: number; duration?: number; }) { - const [top, setTop] = useState(true); const [starsCount, setStarsCount] = useState(3000); const [number, setNumber] = useState(start); - // detect whether user has scrolled the page down by 10px const scrollHandler = () => { window.pageYOffset > 10 ? setTop(false) : setTop(true); @@ -57,8 +55,9 @@ export default function CountingNumbers({ fetchStarsCount(); }, [starsCount]); // Include starsCount as a dependency - - let increment = Math.floor(Math.abs(start - starsCount) / (duration / interval)); + let increment = Math.floor( + Math.abs(start - starsCount) / (duration / interval) + ); if (increment === 0) { increment = 1; } @@ -99,11 +98,9 @@ export default function CountingNumbers({ } }, [isInView]); - - return (

- {Intl.NumberFormat().format(number)} + {Intl.NumberFormat().format(starsCount)}

); -} \ No newline at end of file +}