-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
124 lines (95 loc) · 3.3 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
const proyectoscontainer = document.querySelector(".proyectos-container");
const btn = document.querySelector("#button")
emailjs.init(config.emailjsUserId)
function mostrarFormulario(){
document.querySelector('.overlay').style.display='block';
document.querySelector('.popup-container').style.display='block';
}
function cerrarFormulario(){
document.querySelector('.overlay').style.display='none';
document.querySelector('.popup-container').style.display='none';
}
document.getElementById('form')
.addEventListener('submit', function(event){
event.preventDefault(); // ===> captura, bloquea el evento
btn.value = "Enviando..."
const serviceID = 'default_service';
const templateID = config.emailTemplate;
emailjs.sendForm(serviceID, templateID, this)
.then(() => {
btn.value = 'Send Email';
alert('Sent!');
}, (err) => {
btn.value = 'Send Email';
alert(JSON.stringify(err));
});
})
let render= '';
proyectosData.forEach((proyecto,index) =>{
render=render+`<div class="proyecto-card">
<img
src="${proyecto.imagen}"
alt="${proyecto.nombre}"
class="proyecto-img"
>
<div class="proyecto-info">
<div class="proyecto-nombre">
${proyecto.nombre}
</div>
<div class="proyecto-descripcion">
${proyecto.descripcion}
</div>
<a
class="proyecto-enlace"
href="${proyecto.enlaceGithub}">
ver en Github.
</a>
</div>
</div>`
/*
// 1)
// Crear un nuevo elemento 'div' peara representar una tarjeta de producto
const proyectoCard=document.createElement('div');
// se agrega una clase a el div creado
proyectoCard.classList.add('proyecto-card');
// 2)
// Crear un elemento div 'proyecto-ifo'
const proyectoInfo = document.createElement('div');
// Se agrega la clase 'proyecto-info'
proyectoInfo.classList.add('proyecto-info');
// 2.a) ====> nombre
const nombre = document.createElement('div');
nombre.classList.add('proyecto-nombre');
nombre.textContent = proyecto.nombre
// 2.b) ====> descripción
const descripcion =document.createElement('div');
descripcion.classList.add('proyecto-descripcion');
descripcion.textContent = proyecto.descripcion;
// 2.c) ====> enlace
const enlace= document.createElement('a');
enlace.classList.add('proyecto-enlace');
enlace.href= proyecto.enlaceGithub;
enlace.target = '_blank';
enlace.textContent = "ver en gitHub";
proyectoInfo.appendChild(nombre);
proyectoInfo.appendChild(descripcion);
proyectoInfo.appendChild(enlace);
// 3)
// Crear un elemento img para la imagen del proyecto
const image = document.createElement('img');
// Se agrega la clase a el elemeto img
image.classList.add('proyecto-img');
image.src= proyecto.imagen;
image.alt= proyecto.nombre;
// 3)
// Añadir imagen dentro de Proyecto card
proyectoCard.appendChild(image)
// 2)
// Añadir Proyecto info dentro proyecto card
proyectoCard.appendChild(proyectoInfo)
// 1)
// agregar el elemento de clase proyecto card
proyectoscontainer.appendChild(proyectoCard)
*/
})
proyectoscontainer.innerHTML= render