I try to make a component that looks like this below. The red div has a constant height: 70px;
, the green one has height: 50px;
and max-height: 150px;
and the blue one need to has height
of the rest space. I tried something like this:
const input = useRef(null);
return (
<Wrapper>
<TopBar />
<BottomPanel inputHeight={input?.current?.style?.height}/>
<WritePanel ref={input}/>
</Wrapper>
);
const Wrapper = styled.div`
height: 100%;
`;
const BottomPanel = styled.div`
height: ${({ inputHeight }) =>
inputHeight ? `calc(100% - 70px - ${inputHeight})` : `calc(100% - 120px)`};
`;
const WritePanel = styled.div`
min-height: 50px;
max-height: 150px;
`;
but it doesn't work. How can I do this correctly? I am using React
and ```styled-components``.