-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
36 lines (33 loc) · 1.01 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { GridStackOptions } from "gridstack";
import { useState } from "react";
import {
CUSTOM_DRAGGABLE_HANDLE_CLASSNAME,
defaultGridOptions,
} from "../../default-grid-options";
import {
GridStackHandleReInitializer,
GridStackItem,
GridStackProvider,
GridStackRender,
} from "../../lib";
export function CustomHandle() {
const [uncontrolledInitialOptions] = useState<GridStackOptions>(() => ({
...defaultGridOptions,
children: [{ id: "003-item1", h: 2, w: 2, x: 0, y: 0 }],
}));
return (
<GridStackProvider initialOptions={uncontrolledInitialOptions}>
<GridStackRender>
<GridStackItem id="003-item1">
<div>Custom Handle</div>
{/* Experimental: Render item with custom handle */}
<GridStackHandleReInitializer>
<button className={CUSTOM_DRAGGABLE_HANDLE_CLASSNAME}>
Handle ONLY HERE
</button>
</GridStackHandleReInitializer>
</GridStackItem>
</GridStackRender>
</GridStackProvider>
);
}