I would like to create a layout like this:
I would like to use React and Flex.
To do that I'm using Tachyons and it's media queries that are:
ns
= not small ->@media screen and (min-width: 30em)
= [0, 30em]m
= medium ->@media screen and (min-width: 30em) and (max-width: 60em)
= [30em, 60em]l
= large ->@media screen and (min-width: 60em)
= [60em, ∞]
The layout must be responsive. Basically, the layout is composed by two columns (on desktop) or by two rows (on mobile/tablet). At the first time there are a single column/row (the grey one), when user click on it, the second column/row appears.
This is what I try.
As you can see, on desktop, it works well, I have two columns. On mobile/tablet it doesn't work:
Then, how can I change the layout onClick
event?
function App() {
return (
<div
className="ba b--red bw1 w-100 h-100 flex flex-wrap flex-auto flex-row-l flex-column"
>
<div className="flex justify-center items-center bg-purple w-100 w-50-l h-100-l order-1"/>
<div className="bg-orange flex flex-column justify-center w-100 w-50-l h-100-l order-2 pb4"/>
</div>
)
}
const app = <App />;
const root = document.getElementById("react-root");
ReactDOM.render(app, root);
body, html {
height: 100%;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/tachyons/4.9.0/tachyons.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>
<div id="react-root" className="h-100" style="height:100%"></div>