From c826ad66df066b90b09009f2f4b83b56d018436e Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Wed, 15 Nov 2023 16:37:16 +0100
Subject: refactor(hooks): rewrite useScrollPosition hook

* return the scroll position (both X and Y)
* no longer accepts arguments
* add tests
---
 src/utils/hooks/use-scroll-position.tsx | 13 -------------
 1 file changed, 13 deletions(-)
 delete mode 100644 src/utils/hooks/use-scroll-position.tsx

(limited to 'src/utils/hooks/use-scroll-position.tsx')

diff --git a/src/utils/hooks/use-scroll-position.tsx b/src/utils/hooks/use-scroll-position.tsx
deleted file mode 100644
index c6ae9fd..0000000
--- a/src/utils/hooks/use-scroll-position.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import { useEffect } from 'react';
-
-/**
- * Execute the given function based on scroll position.
- *
- * @param scrollHandler - A callback function.
- */
-export const useScrollPosition = (scrollHandler: () => void) => {
-  useEffect(() => {
-    window.addEventListener('scroll', scrollHandler);
-    return () => window.removeEventListener('scroll', scrollHandler);
-  }, [scrollHandler]);
-};
-- 
cgit v1.2.3

