import React from 'react'; import { createStyles, Theme, makeStyles } from '@material-ui/core/styles'; import GridList from '@material-ui/core/GridList'; import GridListTile from '@material-ui/core/GridListTile'; import GridListTileBar from '@material-ui/core/GridListTileBar'; import IconButton from '@material-ui/core/IconButton'; import StarBorderIcon from '@material-ui/icons/StarBorder'; import tileData from './tileData'; const useStyles = makeStyles((theme: Theme) => createStyles({ root: { display: 'flex', flexWrap: 'wrap', justifyContent: 'space-around', overflow: 'hidden', backgroundColor: theme.palette.background.paper, }, gridList: { width: 500, height: 450, // Promote the list into his own layer on Chrome. This cost memory but helps keeping high FPS. transform: 'translateZ(0)', }, titleBar: { background: 'linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, ' + 'rgba(0,0,0,0.3) 70%, rgba(0,0,0,0) 100%)', }, icon: { color: 'white', }, }), ); /** * The example data is structured as follows: * * import image from 'path/to/image.jpg'; * [etc...] * * const tileData = [ * { * img: image, * title: 'Image', * author: 'author', * featured: true, * }, * { * [etc...] * }, * ]; */ export default function AdvancedGridList() { const classes = useStyles(); return (
{tileData.map((tile) => ( {tile.title} } actionPosition="left" className={classes.titleBar} /> ))}
); }