Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 5483 | Ir a la última revisión | | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
5473 stevensc 1
/* eslint-disable react/prop-types */
2
import React, { useState } from "react";
3
import LocationModal from "./LocationModal";
4
 
5
const Location = ({ formattedAddress, userIdEncrypted }) => {
6
  const [isModalOpen, setIsModalOpen] = useState(false);
7
  const [settedAddress, setSettedAddress] = useState(formattedAddress);
8
 
9
  const handleEdit = async (e) => {
10
    e.preventDefault();
11
    setIsModalOpen(true);
12
  }
13
 
14
  return (
15
    <>
16
      <div className="user-profile-ov">
17
        <h3 style={{ display: "flex" }}>
18
          Ubicación
19
          <div>
20
            <a
21
              href="#"
22
              title=""
23
              className="btn-location-edit"
24
              onClick={handleEdit}
25
            >
26
              <i className="fa fa-pencil"></i>
27
            </a>
28
          </div>
29
        </h3>
30
        <p>{settedAddress || 'Sin información'}</p>
31
      </div>
32
      <LocationModal
33
        isModalOpen={isModalOpen}
34
        closeModal={() => setIsModalOpen(false)}
35
        setSettedAddress={(newAddress) => setSettedAddress(newAddress)}
36
        userIdEncrypted={userIdEncrypted}
37
      />
38
    </>
39
  );
40
};
41
 
42
export default Location;