Files
pawol.nu/components/rezo/kat-rezo-nou.js
T

66 lines
1.9 KiB
JavaScript
Raw Normal View History

2022-02-08 21:49:02 +04:00
import {useState} from 'react'
2022-02-02 07:33:52 +04:00
import PropTypes from 'prop-types'
import Card from '@mui/material/Card'
import CardContent from '@mui/material/CardContent'
2022-02-08 22:23:02 +04:00
import CardActionArea from '@mui/material/CardActionArea'
import Divider from '@mui/material/Divider'
import Grid from '@mui/material/Grid'
2022-02-02 07:33:52 +04:00
import Typography from '@mui/material/Typography'
2022-05-08 23:46:02 +04:00
import {CardMedia} from '@mui/material'
import RezoImaj from '../rezo-imaj'
2022-02-08 21:49:02 +04:00
export default function KatRezoNou({tit, img, soutit, ko, lyen}) {
const [open, setOpen] = useState(false)
const handleClickOpen = () => {
setOpen(true)
}
2022-02-02 07:33:52 +04:00
return (
2022-02-08 21:49:02 +04:00
<>
2022-05-08 23:46:02 +04:00
<Grid item xs={12} md={6} sx={{marginBottom: 2}}>
2022-02-08 21:49:02 +04:00
<Card raised>
<CardActionArea onClick={handleClickOpen}>
2022-05-08 23:46:02 +04:00
<CardMedia
component='img'
height='140'
image={`/captures/${img}.png`}
alt={`Aperçu ${tit}`}
/>
<CardContent>
<Typography color='primary' variant='h6' component='div'>
{tit}
</Typography>
<Typography variant='h6' component='div'>
{soutit}
</Typography>
<Typography variant='body2'>
{ko}
</Typography>
</CardContent>
2022-02-08 21:49:02 +04:00
</CardActionArea>
2022-02-09 07:18:48 +04:00
<Divider sx={{borderWidth: 1}} />
2022-05-08 23:46:02 +04:00
<CardActionArea onClick={() => window.open(lyen, '_blank')}>
<CardContent>
<Typography textAlign='center' color='primary' variant='h6' component='div'>
Accéder à {tit}
</Typography>
</CardContent>
</CardActionArea>
2022-02-08 21:49:02 +04:00
</Card>
</Grid>
2022-02-09 19:34:06 +04:00
<RezoImaj tit={tit} img={img} open={open} setOpen={setOpen} />
2022-02-08 21:49:02 +04:00
</>
2022-02-02 07:33:52 +04:00
)
}
KatRezoNou.propTypes = {
tit: PropTypes.string.isRequired,
2022-02-08 21:49:02 +04:00
img: PropTypes.string.isRequired,
2022-02-02 07:33:52 +04:00
soutit: PropTypes.string.isRequired,
ko: PropTypes.string.isRequired,
lyen: PropTypes.string.isRequired
}