Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 1 | Rev 385 | 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}
44
        onHide={() => {
45
          onClose(false);
46
        }}
47
        style={{ overflowY: "scroll" }}
48
      >
49
        <Modal.Header closeButton>
50
          <Modal.Title>{title}</Modal.Title>
51
        </Modal.Header>
52
        <Modal.Body>
53
          {message && message}
54
          <StyledModalBody>
55
            <Button size="lg" type="submit" onClick={onAccept}>
56
              {acceptLabel}
57
            </Button>
58
            <Button
59
              size="lg"
60
              onClick={() => {
61
                onClose(false);
62
              }}
63
            >
64
              Cancelar
65
            </Button>
66
          </StyledModalBody>
67
        </Modal.Body>
68
 
69
        {loading && (
70
          <div className="spinner-container">
71
            <Spinner />
72
          </div>
73
        )}
74
      </Modal>
75
    </StyledModal>
76
  );
77
};
78
 
79
export default ConfirmModal;