0

I would like to achieve this layout using GridList and GridListTile from Material UI:

enter image description here

I don't know to achieve the layout in the screenshot above. I implemented this layout, but I don't know how to change that:

enter image description here

codesandbox

import React from "react";
import "./styles.css";
import GridList from "@material-ui/core/GridList";
import GridListTile from "@material-ui/core/GridListTile";

function FstBox(props) {
  return <div style={{ background: "yellow", height: "100%" }}>fst box</div>;
}

function SndBox(props) {
  return <div style={{ background: "green", height: "100%" }}>snd Box</div>;
}

function ThdBox(props) {
  return <div style={{ background: "blue", height: "100%" }}>thd Box</div>;
}

export default function App() {
  return (
    <div className="App">
      <GridList cellHeight={80} cols={12}>
        <GridListTile cols={6} rows={1}>
          <FstBox />
        </GridListTile>
        <GridListTile cols={6} rows={2}>
          <SndBox />
        </GridListTile>
        <GridListTile cols={6} rows={1}>
          <ThdBox />
        </GridListTile>
      </GridList>
    </div>
  );
}
Matt
  • 8,195
  • 31
  • 115
  • 225
  • 1
    This could help you, in short I think it is not possible, unless you use Mansory : https://stackoverflow.com/questions/20977390/set-flexbox-children-to-have-different-heights-to-use-up-available-space – Jake Lam Oct 13 '20 at 16:03
  • @JakeLam Thanks. I thought it's like this, but I wasn't 100% sure. – Matt Oct 14 '20 at 09:20

0 Answers0