From 5de3e08d801ec3cb6e05890215a4a49f22d592ba Mon Sep 17 00:00:00 2001 From: Alex P Date: Wed, 22 Nov 2017 15:08:37 -0800 Subject: [PATCH] Pass resizer top & bottom pixels into children --- ui/src/shared/components/ResizeContainer.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ui/src/shared/components/ResizeContainer.js b/ui/src/shared/components/ResizeContainer.js index a8baab69e7..bb8a3aa1c8 100644 --- a/ui/src/shared/components/ResizeContainer.js +++ b/ui/src/shared/components/ResizeContainer.js @@ -34,6 +34,7 @@ class ResizeContainer extends Component { componentDidMount() { this.setState({ bottomHeightPixels: this.bottom.getBoundingClientRect().height, + topHeightPixels: this.top.getBoundingClientRect().height, }) } @@ -92,11 +93,18 @@ class ResizeContainer extends Component { topHeight: `${newTopPanelPercent}%`, bottomHeight: `${newBottomPanelPercent}%`, bottomHeightPixels, + topHeightPixels, }) } render() { - const {bottomHeightPixels, topHeight, bottomHeight, isDragging} = this.state + const { + topHeightPixels, + bottomHeightPixels, + topHeight, + bottomHeight, + isDragging, + } = this.state const {containerClass, children} = this.props if (React.Children.count(children) > maximumNumChildren) { @@ -116,9 +124,14 @@ class ResizeContainer extends Component { onMouseMove={this.handleDrag} ref={r => (this.resizeContainer = r)} > -
+
(this.top = r)} + > {React.cloneElement(children[0], { resizerBottomHeight: bottomHeightPixels, + resizeTopHeight: topHeightPixels, })}
{React.cloneElement(children[1], { resizerBottomHeight: bottomHeightPixels, + resizerTopHeight: topHeightPixels, })}