Skip to content

Instantly share code, notes, and snippets.

@maruware
Created August 9, 2019 09:02
Show Gist options
  • Save maruware/7da93377bfd4ecad82aad0b0b00eb0b4 to your computer and use it in GitHub Desktop.
Save maruware/7da93377bfd4ecad82aad0b0b00eb0b4 to your computer and use it in GitHub Desktop.
materil-ui placeholder image
import React from 'react'
import { makeStyles } from '@material-ui/core/styles'
import ImageIcon from '@material-ui/icons/Image'
interface PlaceHolderImageProps {
width: number
height: number
}
const useStyles = makeStyles(theme => ({
root: {
backgroundColor: theme.palette.grey[300],
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
}
}))
const PlaceholderImage: React.FC<PlaceHolderImageProps> = ({
width,
height
}) => {
const classes = useStyles()
return (
<div style={{ width, height }} className={classes.root}>
<ImageIcon fontSize="large" />
</div>
)
}
export default PlaceholderImage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment