This commit is contained in:
chamikaJ
2025-04-17 18:28:54 +05:30
parent f583291d8a
commit 8825b0410a
2837 changed files with 241385 additions and 127578 deletions

View File

@@ -0,0 +1,25 @@
import { useEffect } from 'react';
import useIsomorphicLayoutEffect from './useIsomorphicLayoutEffect';
/**
* Custom hook to handle cursor style changes during drag operations
* @param isDragging - Boolean indicating if an item is being dragged
*/
const useDragCursor = (isDragging: boolean) => {
useIsomorphicLayoutEffect(() => {
if (!isDragging) return;
// Save the original cursor style
const originalCursor = document.body.style.cursor;
// Apply grabbing cursor to the entire document when dragging
document.body.style.cursor = 'grabbing';
// Reset cursor when dragging stops or component unmounts
return () => {
document.body.style.cursor = originalCursor;
};
}, [isDragging]);
};
export default useDragCursor;