Skip to content

Commit 007f755

Browse files
authored
Merge pull request #31 from CodeStrong2023/Bruno_Olivera
clase 02 e-commerce basico parte 2
2 parents ca6b927 + 2ba3f34 commit 007f755

11 files changed

Lines changed: 114 additions & 91 deletions

File tree

Laboratorio IV/.DS_Store

6 KB
Binary file not shown.
6 KB
Binary file not shown.
6 KB
Binary file not shown.
6 KB
Binary file not shown.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const modalContainer = document.getElementById("modal-container");
2+
const modalOverlay = document.getElementById("modal-overlay");
3+
4+
const cartBtn = document.getElementById("cart-btn");
5+
6+
const displayCart = () => {
7+
modalContainer.innerHTML = "";
8+
modalContainer.style.display = "block";
9+
modalOverlay.style.display = "block";
10+
//modal Header
11+
const modalHeader = document.createElement("div");
12+
13+
const modalClose = document.createElement("div");
14+
modalClose.innerText = "❌";
15+
modalClose.className = "modal-close";
16+
modalHeader.append(modalClose);
17+
18+
modalClose.addEventListener("click", ()=> {
19+
modalContainer.style.display = "none";
20+
modalOverlay.style.display = "none";
21+
})
22+
23+
const modalTitle = document.createElement("div");
24+
modalTitle.innerText = "Cart";
25+
modalTitle.className = "modal-title";
26+
modalHeader.append(modalTitle);
27+
28+
modalContainer.append(modalHeader);
29+
}
30+
31+
cartBtn.addEventListener("click", displayCart);

Laboratorio IV/JavaScript/e-commerce/client/js/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const shopContent = document.getElementById("shopContent");
2+
const cart = [];//Este es nuestro carrito, un array vacio
23

34
productos.forEach((product) =>{
45
const content = document.createElement("div");
@@ -8,4 +9,19 @@ productos.forEach((product) =>{
89
<p>${product.price} $</p>
910
`;
1011
shopContent.append(content);
12+
const buyButton = document.createElement('button');
13+
buyButton.innerText = "Comprar";
14+
15+
content.append(buyButton);
16+
17+
buyButton.addEventListener("click", ()=>{
18+
cart.push({
19+
id: producto.id,
20+
productName: product.productName,
21+
price: product.price,
22+
quanty: product.quanty,
23+
img: product.img,
24+
})
25+
console.log(cart);
26+
})
1127
});

Laboratorio IV/JavaScript/e-commerce/client/media/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
<div class="card-products-container">
1212
<div class="card-products" id="shopContent"></div>
1313
</div>
14-
14+
<!--cart-btn-->
15+
<div class="cart-btn" id="cart-btn">🛒</div>
1516
<script src="/client/js/products.js"></script>
1617
<script src="/client/js/index.js"></script>
17-
18+
<script src="/client/js/cart.js"></script>
1819
</body>
1920
</html>

Laboratorio IV/JavaScript/e-commerce/client/media/styles.css

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,67 @@
3030
}
3131

3232
.card-products button:hover {
33-
opacity: 0,7;
34-
}
33+
opacity: 0.7;
34+
}
35+
36+
/*card button*/
37+
.cart-btn {
38+
position: fixed;
39+
top: 90vh;
40+
right: 40px;
41+
background-color: rgb(25, 25, 25);
42+
padding: 10px;
43+
border-radius: 50%;
44+
height: 24px;
45+
width: 24px;
46+
transition: transform 0.2s ease-in-out;
47+
}
48+
49+
.cart-btn:hover {
50+
cursor: pointer;
51+
opacity: 0.9;
52+
}
53+
54+
/*modal*/
55+
.modal-overlay {
56+
display: none;
57+
background-color: rgba(0, 0, 0, 0);
58+
position: fixed;
59+
top: 0;
60+
left: 0;
61+
right: 0;
62+
bottom: 0;
63+
z-index: 1;
64+
}
65+
66+
.modal-container {
67+
display: none;
68+
background-color: #ffffff;
69+
box-shadow: 0px 3px 6px #00000029;
70+
padding: 40px;
71+
position: absolute;
72+
top: 50%;
73+
left: 50%;
74+
transform: translate(-50%, -50%);
75+
max-width: 500px;
76+
width: 100%;
77+
z-index: 1;
78+
max-height: 80vh;
79+
overflow-y: auto;
80+
}
81+
82+
.modal-container::-webkit-scrollbar{
83+
display: none;
84+
}
85+
86+
.modal-close {
87+
float: right;
88+
cursor: pointer;
89+
}
90+
91+
.modal-title {
92+
font-size: 24px;
93+
font-weight: bold;
94+
margin-bottom: 20px;
95+
text-align: center;
96+
}

Laboratorio IV/Python/Clase 02/Sistema_numeracion.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

Laboratorio IV/Python/Clase 02/tipo_float.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)