Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev Autor Línea Nro. Línea
6539 stevensc 1
import React, { useEffect, useState } from 'react'
2
import { getData } from '../../../helpers/fetchHelpers';
3
import SocialNetworksModal from './SocialNetworksModal';
4
 
5
const SocialNetworks = ({ socialNetworksUrl }) => {
6
 
7
    const [isShowModal, setIsShowModal] = useState(false);
8
    const [socialNetworks, setSocialNetworks] = useState({
9
        facebook: '',
10
        twitter: '',
11
        instagram: ''
12
    });
13
 
14
    const closeModal = () => setIsShowModal(false)
15
    const showModal = () => setIsShowModal(true)
16
 
17
    useEffect(() => {
18
        getData(socialNetworksUrl)
19
            .then(resp => setSocialNetworks(resp))
20
            .catch(err => console.log(err))
21
    }, []);
22
 
23
 
24
    return (
25
        <>
26
            <div className="user-social-network-ov">
27
                <h3>
28
                    Redes Sociales
29
                    <button
30
                        className="btn btn-social-network-edit"
31
                        onClick={showModal}
32
                    >
33
                        <i className="fa fa-pencil"></i>
34
                    </button>
35
                </h3>
36
            </div>
37
            <ul id="social-networks" className="social_links list-unstyled">
38
                <li>
39
                    <a href={socialNetworks.facebook} target="_blank" title="">
40
                        <i className="fa fa-facebook-square btn-social-network-edit" />
41
                        {socialNetworks.facebook}
42
                    </a>
43
                </li>
44
                <li>
45
                    <a href={socialNetworks.twitter} title="" target="_blank">
46
                        <i className="fa fa-twitter btn-social-network-edit" />
47
                        {socialNetworks.twitter}
48
                    </a>
49
                </li>
50
                <li>
51
                    <a href={socialNetworks.instagram} target="_blank" title="">
52
                        <i className="fa fa-instagram btn-social-network-edit" />
53
                        {socialNetworks.instagram}
54
                    </a>
55
                </li>
56
            </ul>
57
            <SocialNetworksModal
58
                action={setSocialNetworks}
59
                socialNetworksUrl={socialNetworksUrl}
60
                isOpen={isShowModal}
61
                closeModal={closeModal}
62
            />
63
        </>
64
 
65
    )
66
}
67
 
68
export default SocialNetworks