I am using Material-ui-next and trying to create images in a very particular fashion.
------ ---------
| | | | 2 |
| | | 1 |---|
| | | | 3 |
------ ---------
I have had a few fairly odd issues.
1 - 3 appears under 1
2 - 2 and 3 do not fill up their entire space (when highlighted, only half the content space is utilized regardless of image)
3 - sometimes I will get something resembling the below:
------ ---------
| | | | 2 |
| | | 1 |---|
| | | | 3 |
| | ---------
------
in that instance, everything on the right isn't extending all the way down
For your reference, if you follow this link then you will go to the material-ui-next GridList docs. Under Advanced Grid List
, you will see one big image and many small ones underneath. My goal is to simply flip that horizontally.
I have attampted the following:
<GridList cols={4} rows={2}>
{
media.map((file, i) => (
<GridListTile style={{ display: 'flex', flexFlow: 'wrap row' }} cellHeight={200} key={i} cols={i===0 ? 3 : 1} rows={i===0 ? 2 : 1}>
<img src={file.url} />
</GridListTile>
))
}
</GridList>
The above resulted in 3 appearing below 2
<GridList cols={2} row={2} className={classes.gridList}>
{
<GridListTile cellHeight={200} key={1} cols={2} rows={2}>
<img src={file.url} />
</GridListTile>
}
</GridList>
</Grid>
<Grid item xs={12} md={3} style={{padding: '14px', paddingLeft: 0}}>
<Typography style={{ visibility: 'hidden' }}>a</Typography>
<GridList>
{
user && user.Media &&
<GridListTile cellHeight={200} style={{paddingBottom: 0}}>
<img src={file.url} />
</GridListTile>
}
</GridList>
<GridList>
{
user && user.Media &&
<GridListTile cellHeight={200} key={1} cols={1}>
<img src={file.url} />
</GridListTile>
}
</GridList>
This solves issue 1 but then 2 and 3 remained.
I have tried to use native flex-box but every time I do the image that is supposed to be larger gets converted to the sizes of the others.
This is the css I have used for flex-box (admittedly little).
gridContainer: {
display: 'flex',
flexFlow: 'row',
justifyContent: 'space-around',
margin: '3rem 0'
},
EDIT - NEW
The below is working better than anything above. The two small side images working perfectly and will change size with the screen. The large image will not and will stay completely fixed.
New CSS
gridList: {
transform: 'translateZ(0)',
display: 'flex',
justifyContent: 'left',
alignItems: 'left',
overflow: 'hidden',
'& img': {
flexShrink: 1,
minWidth: '200%',
minHeight: '200%'
}
},
gridListSmall: {
transform: 'translateZ(0)',
display: 'flex',
justifyContent: 'left',
alignItems: 'left',
overflow: 'hidden',
'& img': {
flexShrink: 0,
minWidth: '100%',
minHeight: '100%'
}
},
New HTML/JSX
<div cols={2} row={2} className={classes.gridList}>
{
<div cellHeight={200} key={1} cols={2} rows={2}>
<img src={file.url} />
</div>
}
</div>
</Grid>
<Grid item xs={12} md={3} style={{padding: '14px', paddingLeft: 0}}>
<Typography style={{ visibility: 'hidden' }}>a</Typography>
<div>
{
user && user.Media &&
<div cellHeight={200} style={{paddingBottom: 0}}>
<img src={file.url} />
</div>
}
</div>
<div>
{
user && user.Media &&
<div cellHeight={200} key={1} cols={1}>
<img src={file.url} />
</div>
}
</div>