auto-claude: subtask-4-4 - Add JSDoc to useScrollLock.ts hook
This commit is contained in:
@@ -1,8 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* Scroll Lock Hook
|
||||||
|
* Manages body scroll locking based on state and navigation transitions
|
||||||
|
*/
|
||||||
|
|
||||||
// hooks/useScrollLock.ts
|
// hooks/useScrollLock.ts
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { useLocation } from 'react-router-dom';
|
import { useLocation } from 'react-router-dom';
|
||||||
import { useScrollContext } from '../components/ScrollContext';
|
import { useScrollContext } from '../components/ScrollContext';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom hook to lock/unlock page scrolling
|
||||||
|
* Automatically handles scroll restoration on route changes and cleanup on unmount
|
||||||
|
* @param lock - Whether to lock the page scroll
|
||||||
|
*/
|
||||||
export const useScrollLock = (lock: boolean) => {
|
export const useScrollLock = (lock: boolean) => {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const { isTransitioning, lockScroll, unlockScroll } = useScrollContext();
|
const { isTransitioning, lockScroll, unlockScroll } = useScrollContext();
|
||||||
|
|||||||
Reference in New Issue
Block a user