Skip to content

Commit 40bde82

Browse files
committed
use isDragging prop to toggle cursor
1 parent b28e140 commit 40bde82

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

components/drag-handle/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import type { HTMLAttributes } from 'react';
22

3+
interface DragHandleProps extends HTMLAttributes<HTMLSpanElement> {
4+
isDragging?: boolean;
5+
}
6+
37
/**
48
* Renders an SVG drag handle.
59
*
610
* @param {object} props The prop object.
711
* @returns {*} React JSX
812
*/
9-
10-
export const DragHandle: React.FC<HTMLAttributes<HTMLSpanElement>> = (props) => (
11-
<span {...props} style={{ cursor: props['aria-pressed'] ? 'grabbing' : 'grab' }}>
13+
export const DragHandle: React.FC<DragHandleProps> = (props) => (
14+
<span {...props} style={{ cursor: props.isDragging ? 'grabbing' : 'grab' }}>
1215
<svg
1316
style={{ marginRight: '10px', cursor: 'grab', flexShrink: 0 }}
1417
width="18"

components/repeater/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const SortableItem = ({ children, item = {}, setItem = null, removeItem = null,
6666
: repeaterItem.props.className,
6767
},
6868
[
69-
<DragHandle className="repeater-item__drag-handle" {...attributes} {...listeners} />,
69+
<DragHandle className="repeater-item__drag-handle" {...attributes} {...listeners} isDragging={ isDragging } />,
7070
repeaterItem.props.children,
7171
],
7272
);

0 commit comments

Comments
 (0)