Files

83 lines
1.9 KiB
JavaScript
Raw Permalink Normal View History

2022-02-08 21:47:48 +04:00
import PropTypes from 'prop-types'
import Backdrop from '@mui/material/Backdrop'
import Image from 'next/image'
import useMediaQuery from '@mui/material/useMediaQuery'
2022-06-02 07:41:07 +04:00
import lyannaj from '../public/captures/lyannaj.png'
2022-02-08 22:10:52 +04:00
import pale from '../public/captures/pale.png'
import gade from '../public/captures/gade.png'
2022-05-28 00:09:25 +04:00
import ouwe from '../public/captures/ouwe.png'
import ekriti from '../public/captures/ekriti.png'
2022-02-08 22:10:52 +04:00
import mobilize from '../public/captures/mobilize.png'
2022-02-19 21:52:18 +04:00
import mizik from '../public/captures/mizik.png'
2022-06-12 20:03:13 +04:00
import zwezo from '../public/captures/zwezo.png'
2022-02-08 21:47:48 +04:00
2022-02-09 19:34:06 +04:00
export default function RezoImaj({tit, img, open, setOpen}) {
2022-02-08 21:47:48 +04:00
const isSmallDevice = useMediaQuery('(max-width:1160px)')
2022-02-08 22:10:52 +04:00
const getSource = source => {
2022-06-02 07:41:07 +04:00
if (source === 'lyannaj') {
return lyannaj
}
2022-06-12 20:03:13 +04:00
if (source === 'zwezo') {
return zwezo
}
2022-02-08 22:10:52 +04:00
if (source === 'pale') {
return pale
}
if (source === 'gade') {
return gade
}
2022-05-28 00:09:25 +04:00
if (source === 'ouwe') {
return ouwe
}
if (source === 'ekriti') {
return ekriti
}
2022-02-08 22:10:52 +04:00
if (source === 'mobilize') {
return mobilize
}
2022-02-19 21:52:18 +04:00
if (source === 'mizik') {
return mizik
}
2022-02-08 22:10:52 +04:00
}
const source = getSource(img)
2022-02-08 21:47:48 +04:00
const handleClose = () => {
setOpen(false)
}
return (
<div>
<Backdrop
sx={{color: '#fff', zIndex: theme => theme.zIndex.drawer + 1}}
open={open}
onClick={handleClose}
>
<div style={{width: isSmallDevice ? '100%' : '70%', height: isSmallDevice ? '100%' : '70%', position: 'relative'}}>
<Image
2022-02-08 22:10:52 +04:00
src={source}
2022-02-09 19:34:06 +04:00
alt={`Aperçu ${tit}`}
2022-02-08 21:47:48 +04:00
layout='fill'
objectFit='contain'
2022-02-08 22:10:52 +04:00
placeholder='blur'
2022-02-08 21:47:48 +04:00
/>
</div>
</Backdrop>
</div>
)
}
RezoImaj.propTypes = {
img: PropTypes.string.isRequired,
2022-02-09 19:34:06 +04:00
tit: PropTypes.string.isRequired,
2022-02-08 21:47:48 +04:00
open: PropTypes.bool.isRequired,
setOpen: PropTypes.func.isRequired
}