Add client side removing of items, Add item position modal

This commit is contained in:
Meier Lukas
2023-10-02 20:29:26 +02:00
parent 9c614d8823
commit 076bd94970
9 changed files with 142 additions and 135 deletions

View File

@@ -0,0 +1,24 @@
import { useGridItemRef } from '../item/context';
import { useGridstackRef } from './context';
type ResizeGridItemProps = {
height: number;
width: number;
x: number;
y: number;
};
export const useResizeGridItem = () => {
const itemRef = useGridItemRef();
const gridstackRef = useGridstackRef();
return ({ height, width, ...options }: ResizeGridItemProps) => {
gridstackRef.current?.batchUpdate();
gridstackRef.current?.update(itemRef.current!, {
...options,
h: height,
w: width,
});
gridstackRef.current?.batchUpdate(false);
};
};