-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d79fa7b
Showing
14 changed files
with
243 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>Alura Geek</title> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="styles.css"> | ||
</head> | ||
|
||
<body> | ||
|
||
<div class="container"> | ||
<header> | ||
<div class="logo"> | ||
<span>AluraGeek 🤓</span> | ||
</div> | ||
</header> | ||
</div> | ||
|
||
|
||
<main> | ||
<div class="products"> | ||
<h1>MIS PRODUCTOS:</h1> | ||
<div class="product-list" id="product-list"> | ||
<!-- Products will be dynamically added here --> | ||
</div> | ||
</div> | ||
<div class="add-product"> | ||
<h2>AGREGAR PRODUCTO:</h2> | ||
<form id="product-form"> | ||
<input type="text" id="product-name" placeholder="nombre..." required> | ||
<input type="text" id="product-price" placeholder="precio..." required> | ||
<input type="text" id="product-image" placeholder="nombre de imagen.jpeg" required> | ||
<button type="submit">Enviar</button> | ||
<button type="reset">Limpiar</button> | ||
</form> | ||
</div> | ||
</main> | ||
|
||
<footer> | ||
<div class="logo"> | ||
<span>AluraGeek 🤓<br> | ||
<h5>Desarrollado por Jesus A. Gutiérrez M.</h5> | ||
<h5>© AluraLatam 2024</h5></span> | ||
</div> | ||
</footer> | ||
<script src="script.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
document.getElementById('product-form').addEventListener('submit', function(event) { | ||
event.preventDefault(); | ||
|
||
// Get form values | ||
const name = document.getElementById('product-name').value; | ||
const price = parseFloat(document.getElementById('product-price').value); | ||
const image = document.getElementById('product-image').value; | ||
|
||
// Format price as currency | ||
const formattedPrice = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(price); | ||
|
||
// Create a new product card | ||
const productCard = document.createElement('div'); | ||
productCard.classList.add('product-card'); | ||
|
||
productCard.innerHTML = ` | ||
<img src="img/${image}" alt="${name}"> | ||
<h3>${name}</h3> | ||
<p>${formattedPrice}</p> | ||
<button onclick="removeProduct(this)">Eliminar</button> | ||
`; | ||
|
||
// Append the product card to the product list | ||
document.getElementById('product-list').appendChild(productCard); | ||
|
||
// Clear form fields | ||
document.getElementById('product-form').reset(); | ||
}); | ||
|
||
function removeProduct(button) { | ||
button.parentElement.remove(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"liveServer.settings.port": 5501 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
body { | ||
font-family: 'Arial', sans-serif; | ||
background-color: #f0f0f0; | ||
margin: 0; | ||
padding: 0; | ||
display: flex; | ||
flex-direction: column; | ||
min-height: 100vh; | ||
} | ||
|
||
.container { | ||
flex: 1; | ||
width: 90%; | ||
max-width: 1200px; | ||
margin: 0 auto; | ||
background-color: #fff; | ||
box-shadow: 0 0 10px rgba(0,0,0,0.1); | ||
padding: 20px; | ||
} | ||
|
||
header { | ||
background-color: #6a1b9a; | ||
color: #fff; | ||
padding: 10px; | ||
text-align: center; | ||
font-size: 24px; | ||
} | ||
|
||
main { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
flex: 1; | ||
} | ||
|
||
.products { | ||
flex: 2; | ||
} | ||
|
||
.add-product { | ||
flex: 1; | ||
margin-top: 20px; | ||
} | ||
|
||
h1, h2 { | ||
font-size: 1.5em; | ||
color: #333; | ||
} | ||
|
||
.product-list { | ||
display: grid; | ||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); | ||
gap: 10px; | ||
} | ||
|
||
.product-card { | ||
background-color: #fff; | ||
border: 1px solid #ddd; | ||
padding: 10px; | ||
text-align: center; | ||
box-shadow: 0 0 5px rgba(0,0,0,0.1); | ||
} | ||
|
||
.product-card img { | ||
max-width: 100%; | ||
height: auto; | ||
} | ||
|
||
.product-card h3 { | ||
font-size: 1em; | ||
margin: 10px 0; | ||
} | ||
|
||
.product-card p { | ||
color: #6a1b9a; | ||
font-weight: bold; | ||
} | ||
|
||
.product-card button { | ||
background-color: #d32f2f; | ||
color: #fff; | ||
border: none; | ||
padding: 5px 10px; | ||
cursor: pointer; | ||
margin-top: 10px; | ||
} | ||
|
||
.product-card button:hover { | ||
background-color: #c62828; | ||
} | ||
|
||
form { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
form input, form button { | ||
margin-bottom: 10px; | ||
padding: 10px; | ||
font-size: 1em; | ||
} | ||
|
||
form button[type="submit"] { | ||
background-color: #007bff; | ||
color: #fff; | ||
border: none; | ||
cursor: pointer; | ||
} | ||
|
||
form button[type="submit"]:hover { | ||
background-color: #0056b3; | ||
} | ||
|
||
form button[type="reset"] { | ||
background-color: #6c757d; | ||
color: #fff; | ||
border: none; | ||
cursor: pointer; | ||
} | ||
|
||
form button[type="reset"]:hover { | ||
background-color: #5a6268; | ||
} | ||
|
||
footer { | ||
background-color: #6a1b9a; | ||
color: #fff; | ||
text-align: center; | ||
padding: 10px; | ||
font-size: 18px; | ||
} | ||
|
||
/* Media Queries for Responsive Design */ | ||
|
||
@media (min-width: 768px) { | ||
main { | ||
flex-direction: row; | ||
} | ||
|
||
.add-product { | ||
margin-left: 20px; | ||
margin-top: 0; | ||
} | ||
} | ||
|
||
@media (max-width: 767px) { | ||
header { | ||
font-size: 20px; | ||
} | ||
|
||
.product-card h3 { | ||
font-size: 0.9em; | ||
} | ||
|
||
.product-card p { | ||
font-size: 0.9em; | ||
} | ||
} |