2022-12-04 17:36:30 +01:00
|
|
|
import { ReactNode, RefObject } from 'react';
|
|
|
|
|
|
|
|
|
|
interface GridstackTileWrapperProps {
|
|
|
|
|
id: string;
|
2022-12-19 17:03:39 +01:00
|
|
|
type: 'app' | 'widget';
|
2022-12-04 17:36:30 +01:00
|
|
|
x?: number;
|
|
|
|
|
y?: number;
|
|
|
|
|
width?: number;
|
|
|
|
|
height?: number;
|
|
|
|
|
minWidth?: number;
|
|
|
|
|
minHeight?: number;
|
|
|
|
|
maxWidth?: number;
|
|
|
|
|
maxHeight?: number;
|
|
|
|
|
itemRef: RefObject<HTMLDivElement>;
|
|
|
|
|
children: ReactNode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const GridstackTileWrapper = ({
|
|
|
|
|
id,
|
|
|
|
|
type,
|
|
|
|
|
x,
|
|
|
|
|
y,
|
|
|
|
|
width,
|
|
|
|
|
height,
|
|
|
|
|
minWidth,
|
|
|
|
|
minHeight,
|
|
|
|
|
maxWidth,
|
|
|
|
|
maxHeight,
|
|
|
|
|
children,
|
|
|
|
|
itemRef,
|
|
|
|
|
}: GridstackTileWrapperProps) => (
|
|
|
|
|
<div
|
|
|
|
|
className="grid-stack-item"
|
|
|
|
|
data-type={type}
|
|
|
|
|
data-id={id}
|
|
|
|
|
gs-x={x}
|
|
|
|
|
gs-y={y}
|
|
|
|
|
gs-w={width}
|
|
|
|
|
gs-h={height}
|
|
|
|
|
gs-min-w={minWidth}
|
|
|
|
|
gs-min-h={minHeight}
|
|
|
|
|
gs-max-w={maxWidth}
|
|
|
|
|
gs-max-h={maxHeight}
|
|
|
|
|
ref={itemRef}
|
|
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
</div>
|
|
|
|
|
);
|