Skip to content

Commit 2b1ddd7

Browse files
committed
fix drag
1 parent 7319160 commit 2b1ddd7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

web/components/Window.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import Draggable from "react-draggable";
2+
import { useRef } from "react";
23

34
export function Window({
45
children,
56
className,
67
...props
78
}: { children: React.ReactNode } & React.HTMLAttributes<HTMLDivElement>) {
9+
const nodeRef = useRef<HTMLDivElement>(null);
10+
811
return (
9-
<Draggable handle=".title-bar">
10-
<div {...props} className={`window ${className || ""}`}>
12+
<Draggable handle=".title-bar" nodeRef={nodeRef}>
13+
<div ref={nodeRef} {...props} className={`window ${className || ""}`}>
1114
{children}
1215
</div>
1316
</Draggable>

0 commit comments

Comments
 (0)