Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 5070 | Rev 5499 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 5070 Rev 5468
Línea 1... Línea 1...
1
/* eslint-disable react/prop-types */
1
/* eslint-disable react/prop-types */
2
import React from 'react'
2
import React from 'react'
3
import Button from 'react-bootstrap/Button'
3
import Button from 'react-bootstrap/Button'
4
import Modal from 'react-bootstrap/Modal'
4
import Modal from 'react-bootstrap/Modal'
5
import styled from 'styled-components'
-
 
6
import Spinner from '../loading-spinner/Spinner'
5
import Spinner from '../loading-spinner/Spinner'
7
import '../../css/shared/global.scss'
6
import { useSelector } from 'react-redux'
Línea 8... Línea 7...
8
 
7
 
9
const StyledModalBody = styled.div`
8
const ConfirmModal = ({
-
 
9
  show = false,
10
  width: 100%;
10
  title = '¿Estás seguro?',
11
  height: 100%;
11
  message = '',
12
  display: flex;
12
  acceptLabel = 'Enviar',
13
  justify-content: space-evenly;
13
  onClose = () => null,
14
  align-items: center;
14
  onAccept = () => null,
15
  margin-top: 1rem;
15
  loading = false,
-
 
16
}) => {
Línea 16... Línea -...
16
`
-
 
17
 
17
  const labels = useSelector((state) => state.labels)
18
const StyledModal = styled.div`
18
 
19
  .modal {
19
  if (!show) {
20
    width: 200px;
-
 
21
  }
-
 
22
`
-
 
23
 
-
 
24
const ConfirmModal = (props) => {
-
 
25
  // props destructuring
-
 
26
  const {
-
 
27
    show,
-
 
28
    onClose,
-
 
29
    title = '¿Estás seguro?',
-
 
30
    loading,
-
 
31
    onAccept,
-
 
32
    message,
-
 
Línea 33... Línea 20...
33
    acceptLabel = 'Enviar'
20
    return null
34
  } = props
-
 
35
 
-
 
36
  return (
-
 
37
    <StyledModal>
-
 
38
      <Modal
21
  }
39
        size="sm"
-
 
40
        show={show}
-
 
41
        onHide={onClose}
22
 
42
        style={{ overflowY: 'scroll' }}
23
  return (
43
      >
24
    <Modal size="sm" show onHide={onClose}>
44
        <Modal.Header closeButton>
25
      <Modal.Header closeButton>
45
          <Modal.Title>{title}</Modal.Title>
26
        <Modal.Title>{title}</Modal.Title>
46
        </Modal.Header>
-
 
47
        <Modal.Body>
-
 
48
          {message && message}
-
 
49
          <StyledModalBody>
27
      </Modal.Header>
50
            <Button
28
      <Modal.Body>
51
              size="lg"
-
 
52
              onClick={onClose}
29
        {message && <p>{message}</p>}
53
            >
30
        {loading && <Spinner />}
54
              {LABELS.CANCEL}
31
      </Modal.Body>
55
            </Button>
32
      <Modal.Footer>
56
            <Button size="lg" type="submit" onClick={onAccept}>
-
 
57
              {acceptLabel}
-
 
58
            </Button>
-
 
59
          </StyledModalBody>
33
        <Button size="lg" type="submit" onClick={onAccept}>
60
        </Modal.Body>
34
          {acceptLabel}
61
        {loading &&
35
        </Button>
62
          <div className="spinner-container">
-
 
63
            <Spinner />
36
        <Button size="lg" onClick={onClose}>
64
          </div>
37
          {labels.CANCEL}
65
        }
38
        </Button>
66
      </Modal>
39
      </Modal.Footer>
Línea 67... Línea 40...
67
    </StyledModal>
40
    </Modal>