Skip to content

Commit

Permalink
pretty/prettier changes
Browse files Browse the repository at this point in the history
  • Loading branch information
michelleyeoh committed Dec 5, 2024
1 parent fb356d5 commit e60e187
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions app/(pages)/_components/CountUp/CountUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,29 @@ const CountUp: React.FC<CountUpProps> = ({

useEffect(() => {
// if (start) {
let startTimestamp: number | null = null;
const step = (timestamp: number) => {
if (!startTimestamp) startTimestamp = timestamp;
const progress = timestamp - startTimestamp;
const currentCount = Math.min(end, (progress / duration) * end);
setCount(currentCount);
if (progress < duration) {
window.requestAnimationFrame(step);
}
};
let startTimestamp: number | null = null;
const step = (timestamp: number) => {
if (!startTimestamp) startTimestamp = timestamp;
const progress = timestamp - startTimestamp;
const currentCount = Math.min(end, (progress / duration) * end);
setCount(currentCount);
if (progress < duration) {
window.requestAnimationFrame(step);
}
};

window.requestAnimationFrame(step);
window.requestAnimationFrame(step);
// }
}, [start, end, duration]);

return (
<div
ref={countUpRef}
style={{ fontFamily: 'Metropolis', color: '005271' }}
>
<div ref={countUpRef} style={{ fontFamily: 'Metropolis', color: '005271' }}>
{/* {start && (
<> */}
{prefix}
{Math.floor(count)}
{suffix}
{/* </>
{prefix}
{Math.floor(count)}
{suffix}
{/* </>
)} */}
</div>
);
Expand Down

0 comments on commit e60e187

Please sign in to comment.