{!noFooter &&
}
-
);
}
diff --git a/src/utils/use-lock-body-scroll.ts b/src/utils/use-lock-body-scroll.ts
new file mode 100644
index 0000000000..2711b3badc
--- /dev/null
+++ b/src/utils/use-lock-body-scroll.ts
@@ -0,0 +1,23 @@
+import { useEffect } from "react";
+
+const useLockBodyScroll = (modalRef: React.RefObject
) => {
+ useEffect(() => {
+ // Get original body overflow
+ const originalStyle = window.getComputedStyle(document.body).overflow;
+ const originalTouchAction = window.getComputedStyle(
+ document.body
+ ).touchAction;
+
+ // Prevent scrolling on mount
+ document.body.style.overflow = "hidden";
+ document.body.style.touchAction = "none";
+
+ // Re-enable scrolling when component unmounts
+ return () => {
+ document.body.style.overflow = originalStyle;
+ document.body.style.touchAction = originalTouchAction;
+ };
+ }, [modalRef]); // Empty array ensures effect is only run on mount and unmount
+};
+
+export default useLockBodyScroll;