import React, { Fragment, PureComponent } from 'react'; import PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core/styles'; import imgApi from 'ba-api/images'; import { Typography, ButtonBase } from '@material-ui/core'; const styles = theme => ({ demo: { height: 'auto', }, divider: { margin: `${theme.spacing(3)}px 0`, }, root: { display: 'flex', flexWrap: 'wrap', minWidth: 300, width: '100%', }, image: { position: 'relative', height: 200, [theme.breakpoints.down('xs')]: { width: '100% !important', // Overrides inline-style height: 100, }, '&:hover, &$focusVisible': { zIndex: 1, '& $imageBackdrop': { opacity: 0.15, }, '& $imageMarked': { opacity: 0, }, '& $imageTitle': { border: '4px solid currentColor', }, }, }, focusVisible: {}, imageButton: { position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, display: 'flex', alignItems: 'center', justifyContent: 'center', color: theme.palette.common.white, }, imageSrc: { position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, backgroundSize: 'cover', backgroundPosition: 'center 40%', }, imageBackdrop: { position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, backgroundColor: theme.palette.common.black, opacity: 0.4, transition: theme.transitions.create('opacity'), }, imageTitle: { position: 'relative', padding: `${theme.spacing(2)}px ${theme.spacing(4)}px ${theme.spacing(1) + 6}px`, }, imageMarked: { height: 3, width: 18, backgroundColor: theme.palette.common.white, position: 'absolute', bottom: -2, left: 'calc(50% - 9px)', transition: theme.transitions.create('opacity'), }, }); const images = [ { url: imgApi[0], title: '330x200', width: '40%', id: '0' }, { url: imgApi[3], title: '250x200', width: '30%', id: '1' }, { url: imgApi[5], title: '250x200', width: '30%', id: '2' }, ]; class ComplexButtons extends PureComponent { render() { const { classes } = this.props; return (
{images.map(image => ( {image.title} ))}
); } } ComplexButtons.propTypes = { classes: PropTypes.object.isRequired, }; export default withStyles(styles)(ComplexButtons);