import React from "react";
import styled from "styled-components";
import { Icon } from "@blueprintjs/core";
import { Resizable, ResizeDirection } from "re-resizable";
import { WidgetProps, WidgetOperations } from "../widgets/BaseWidget";
import { ContainerProps } from "./ContainerComponent";
export type ResizableComponentProps = WidgetProps & ContainerProps;
const ResizableContainer = styled(Resizable)`
border: ${props => {
return Object.values(props.theme.borders[0]).join(" ");
}};
`;
const CustomHandle = (props: any) =>
;
const BottomRightHandle = () => (
);
export const ResizableComponent = (props: ResizableComponentProps) => {
const updateSize = (
e: Event,
dir: ResizeDirection,
ref: any,
delta: { width: number; height: number },
) => {
props.updateWidget &&
props.updateWidget(WidgetOperations.RESIZE, props.widgetId, delta);
};
return (
}}
onResizeStop={updateSize}
grid={[props.parentColumnSpace, props.parentRowSpace]}
enable={{
top: true,
right: true,
bottom: true,
left: true,
topRight: false,
topLeft: false,
bottomRight: true,
bottomLeft: true,
}}
>
{props.children}
);
};
export default ResizableComponent;