Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 357 | Rev 1269 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 1
import React from "react";
2
import { Button, Modal } from "react-bootstrap";
3
import styled from "styled-components";
4
import Spinner from "../loading-spinner/Spinner";
5
import "../../css/shared/global.scss";
6
 
7
const StyledModalBody = styled.div`
8
  width: 100%;
9
  height: 100%;
10
  display: flex;
11
  justify-content: space-evenly;
12
  align-items: center;
13
  margin-top: 1rem;
14
`;
15
 
16
const StyledModal = styled.div`
17
  .modal {
18
    width: 200px;
19
  }
20
`;
21
 
22
const ConfirmModal = (props) => {
23
  // props destructuring
24
  const {
25
    show,
26
    onClose,
27
    title = "Está seguro?",
28
    loading,
29
    onAccept,
30
    message,
31
    acceptLabel = "Enviar",
32
  } = props;
33
 
34
  // states
35
  // const [isLoading, setisLoading] = useState(false);
36
  // useEffect(() => {
37
 
38
  // }, [input])
39
  return (
40
    <StyledModal>
41
      <Modal
42
        size="sm"
43
        show={show}
385 geraldo 44
        onHide={onClose}
1 www 45
        style={{ overflowY: "scroll" }}
46
      >
47
        <Modal.Header closeButton>
48
          <Modal.Title>{title}</Modal.Title>
49
        </Modal.Header>
50
        <Modal.Body>
51
          {message && message}
52
          <StyledModalBody>
385 geraldo 53
          <Button
1 www 54
              size="lg"
385 geraldo 55
              onClick={onClose}
1 www 56
            >
57
              Cancelar
58
            </Button>
385 geraldo 59
            <Button size="lg" type="submit" onClick={onAccept}>
60
              {acceptLabel}
61
            </Button>
1 www 62
          </StyledModalBody>
63
        </Modal.Body>
64
 
65
        {loading && (
66
          <div className="spinner-container">
67
            <Spinner />
68
          </div>
69
        )}
70
      </Modal>
71
    </StyledModal>
72
  );
73
};
74
 
75
export default ConfirmModal;