Import img and add placeholder blur

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2022-02-08 22:10:52 +04:00
parent 0b198eab1f
commit 32cf9fe048
+25 -1
View File
@@ -2,9 +2,32 @@ import PropTypes from 'prop-types'
import Backdrop from '@mui/material/Backdrop'
import Image from 'next/image'
import useMediaQuery from '@mui/material/useMediaQuery'
import pale from '../public/captures/pale.png'
import gade from '../public/captures/gade.png'
import mobilize from '../public/captures/mobilize.png'
import nouvel from '../public/captures/nouvel.png'
export default function RezoImaj({img, open, setOpen}) {
const isSmallDevice = useMediaQuery('(max-width:1160px)')
const getSource = source => {
if (source === 'pale') {
return pale
}
if (source === 'gade') {
return gade
}
if (source === 'mobilize') {
return mobilize
}
if (source === 'nouvel') {
return nouvel
}
}
const source = getSource(img)
const handleClose = () => {
setOpen(false)
@@ -19,9 +42,10 @@ export default function RezoImaj({img, open, setOpen}) {
>
<div style={{width: isSmallDevice ? '100%' : '70%', height: isSmallDevice ? '100%' : '70%', position: 'relative'}}>
<Image
src={`/captures/${img}.png`}
src={source}
layout='fill'
objectFit='contain'
placeholder='blur'
/>
</div>
</Backdrop>