summaryrefslogtreecommitdiff
path: root/client/src/components/Modal/Modal.jsx
blob: 57cb9bb4753301bf018b660b0941a7a01498b7fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import React from 'react'
import { Modal, Box, Button } from '@mui/material'
import styles from './Modal.module.css'
import { Container } from '@mui/system'

const PopUpModal = ({ title, description, image }) => {
  const style = {
    position: 'absolute',
    top: '50%',
    left: '50%',
    transform: 'translate(-50%, -50%)',
    width: 1000,
    bgcolor: 'background.paper',
    borderRadius: '10px',
    boxShadow: 24,
    p: 4
  }
  const [open, setOpen] = React.useState(false)
  const handleOpen = () => setOpen(true)
  const handleClose = () => setOpen(false)

  return (
    <div className={styles.modal}>
      <Button onClick={handleOpen} sx={{ borderRadius: '50%' }}>
        <img
          src={`${process.env.PUBLIC_URL}/assets/images/help.svg`}
          height="65px"
          width="65px"
        />
      </Button>
      <Modal
        open={open}
        onClose={handleClose}
        aria-labelledby="modal-modal-title"
        aria-describedby="modal-modal-description"
      >
        <Box sx={style}>
          <h1 id="modal-modal-title" className={styles.modal__title}>
            {title}
          </h1>
          <Container sx={{ display: 'flex' }}>
            <img
              src={image}
              height="200px"
              width="200px"
              className={styles.modal__image}
            />
            <p className={styles.modal__content}>{description}</p>
          </Container>
        </Box>
      </Modal>
    </div>
  )
}

export default PopUpModal