import React from 'react' import PropTypes from 'prop-types' import {Button, Dialog, DialogActions, DialogContent, DialogTitle, makeStyles, Typography} from '@material-ui/core' import Cgu from '.' import {useRouter} from 'next/router' const CGU_DOWNLOAD_LINK = process.env.NEXT_PUBLIC_CGU_DOWNLOAD_LINK const useStyles = makeStyles(() => ({ dialog: { zIndex: 9999 } })) export default function CGUDialog({open, setOpen}) { const classes = useStyles() const router = useRouter() const handleClose = () => { setOpen(false) } const handleClick = event => { event.preventDefault() router.push(CGU_DOWNLOAD_LINK) } const descriptionElementRef = React.useRef(null) React.useEffect(() => { if (open) { const {current: descriptionElement} = descriptionElementRef if (descriptionElement !== null) { descriptionElement.focus() } } }, [open]) return (