feat: redirect to PDF when NEXT_PUBLIC_CGU_DOWNLOAD_LINK is set
This commit is contained in:
@@ -2,7 +2,6 @@ import {useRef, useEffect} from 'react'
|
||||
import {styled, useTheme} from '@mui/material/styles'
|
||||
import PropTypes from 'prop-types'
|
||||
import {Button, Dialog, DialogActions, DialogContent, DialogTitle, Typography} from '@mui/material'
|
||||
import {useRouter} from 'next/navigation'
|
||||
import useMediaQuery from '@mui/material/useMediaQuery'
|
||||
import Cgu from '.'
|
||||
|
||||
@@ -23,17 +22,11 @@ const CGU_DOWNLOAD_LINK = process.env.NEXT_PUBLIC_CGU_DOWNLOAD_LINK
|
||||
export default function CGUDialog({open, setOpen}) {
|
||||
const theme = useTheme()
|
||||
const fullScreen = useMediaQuery(theme.breakpoints.down('md'))
|
||||
const router = useRouter()
|
||||
|
||||
const handleClose = () => {
|
||||
setOpen(false)
|
||||
}
|
||||
|
||||
const handleClick = event => {
|
||||
event.preventDefault()
|
||||
router.push(CGU_DOWNLOAD_LINK)
|
||||
}
|
||||
|
||||
const descriptionElementRef = useRef(null)
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
@@ -64,7 +57,24 @@ export default function CGUDialog({open, setOpen}) {
|
||||
id='scroll-dialog-description'
|
||||
tabIndex={-1}
|
||||
>
|
||||
{CGU_DOWNLOAD_LINK ? (
|
||||
<div style={{textAlign: 'center', padding: '2rem'}}>
|
||||
<Typography paragraph>
|
||||
Consultez nos CGU et notre politique de confidentialité :
|
||||
</Typography>
|
||||
<Button
|
||||
variant='contained'
|
||||
component='a'
|
||||
href={CGU_DOWNLOAD_LINK}
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
>
|
||||
Consulter les CGU
|
||||
</Button>
|
||||
</div>
|
||||
) : (
|
||||
<Cgu />
|
||||
)}
|
||||
</Typography>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
|
||||
Reference in New Issue
Block a user