For my new react project I need a split pane.
I am using https://github.com/tomkp/react-split-pane for this.
After I implemented everything, I wanted to my header above so it would look like this.
So I added the header to my root component.
render() {
return (
<div className='App'>
<h1>This is my heading</h1>
<SplitPane split='vertical' minSize={50} defaultSize={100}>
<div>split 1</div>
<div>split 2</div>
</SplitPane>
</div>
);
}
}
Just like this without any css it gave me nearly a correct result. And the only problem here is that the split pane seems to take 100vh
as its height and therefore the overall application is bigger. Which gives me the nice scroll bar, which I don't want.
My next idea was to just put everything into css grid (I know that it probably isn't the best use case but at least I would know there how to solve the sizing problem) and then resize it using the relative units.
The css I added to my main component is.
.App {
display: grid;
grid-template-rows: auto 1fr;
}
This change didn't get me the effect I wanted it to. Instead of neatly stacking everything it somehow put the split pane above the header.
I thought that I did something wrong with css grid, so I applied display: flex;
which gave me the same problem.
I don't really know what the problem here is, so I'm curious if anybody had encountered such a problem before.