Import img and add placeholder blur
This commit is contained in:
+25
-1
@@ -2,9 +2,32 @@ import PropTypes from 'prop-types'
|
|||||||
import Backdrop from '@mui/material/Backdrop'
|
import Backdrop from '@mui/material/Backdrop'
|
||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
import useMediaQuery from '@mui/material/useMediaQuery'
|
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}) {
|
export default function RezoImaj({img, open, setOpen}) {
|
||||||
const isSmallDevice = useMediaQuery('(max-width:1160px)')
|
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 = () => {
|
const handleClose = () => {
|
||||||
setOpen(false)
|
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'}}>
|
<div style={{width: isSmallDevice ? '100%' : '70%', height: isSmallDevice ? '100%' : '70%', position: 'relative'}}>
|
||||||
<Image
|
<Image
|
||||||
src={`/captures/${img}.png`}
|
src={source}
|
||||||
layout='fill'
|
layout='fill'
|
||||||
objectFit='contain'
|
objectFit='contain'
|
||||||
|
placeholder='blur'
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Backdrop>
|
</Backdrop>
|
||||||
|
|||||||
Reference in New Issue
Block a user