I am currently trying to create a sidebar. The problem I have is that the container for the element "shrinks to it's content".
I have looked at alternate solutions like flex-grow, setting App.css html,body height to 100%, etc.. but nothing seems to work!
In App.js, the App class renders the following:
return (
<Router>
<Navbar />
<Route path="/" exact component={Landing} />
<Route path="/dashboard" component={DashBar} />
</Router>
);
And in DashBar:
import React from 'react';
import styled from 'styled-components';
const Container = styled.div `
display: flex;
border: solid black 3px;
flex: 1;
`
const DashBorder = styled.div `
width: 10%;
border-right: 2px shadow solid black;
background-color: blue;
`
const OtherContent = styled.div `
width: 90%;
background-color: red;
`
class DashBar extends React.Component {
render() {
return (
<Container>
<DashBorder>Dash</DashBorder>
<OtherContent>Other</OtherContent>
</Container>
);
}
}
export default DashBar
The Question: How do I expand the DashBorder element so that it fits the entirety of the page (with a width of 10%) .