import SplitPane from "react-split-pane"; import React from "react"; import { CSSProperties } from "@material-ui/core/styles/withStyles"; interface IProps { onChange?: (size: number) => any; left: any; right: any; leftStyle?: CSSProperties; rightStyle?: CSSProperties; style?: CSSProperties; direction?: "horizontal" | "vertical"; splitLeft?: boolean; split?: boolean; onlyRenderSplit?: boolean; } const PlaygroundSplitPane: React.FC = (props) => { const handleChange = (size: number) => { if (props.onChange) { props.onChange(size); } }; if ((props.split === false && props.onlyRenderSplit) || (typeof window === 'undefined')) { return (
{typeof window === 'undefined' ? props.left : props.splitLeft ? props.left : props.right }
); } const dir = props.direction || "vertical"; const defaultSize = !props.split ? dir === "horizontal" ? window.innerHeight : window.innerWidth : dir === "horizontal" ? window.innerHeight * .35 : window.innerWidth / 2; return (
{props.left}
{props.right}
); }; export default PlaygroundSplitPane;