Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
2gutierrez authored Jun 8, 2024
0 parents commit d79fa7b
Show file tree
Hide file tree
Showing 14 changed files with 243 additions and 0 deletions.
Binary file added img/Screenshot 2024-06-06 184942.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/alfaromeo.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/alphatauri.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/astonmartin.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ferrari.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/hass.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/mclaren.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/mercedes.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/redbull.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/williams.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions index.html
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 &#129299</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 &#129299<br>
<h5>Desarrollado por Jesus A. Gutiérrez M.</h5>
<h5>&#169 AluraLatam 2024</h5></span>
</div>
</footer>
<script src="script.js"></script>
</body>

</html>
32 changes: 32 additions & 0 deletions script.js
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();
}
3 changes: 3 additions & 0 deletions settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
158 changes: 158 additions & 0 deletions styles.css
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;
}
}

0 comments on commit d79fa7b

Please sign in to comment.