Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
208 changes: 208 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@300;500;700&display=swap" rel="stylesheet">

<title>Wellcome to the DNFTs to shirts revolution</title>
<link rel="stylesheet" href="./style.css"/>
</head>
<body>
<nav>
<img src="./icons/icon_menu.svg" alt="menu" class="menu">

<div class="navbar-left">
<img src="./logos/logo_yard_sale.svg" alt="logo" class="logo">

<ul>
<li>
<a href="/">All</a>
</li>
<li>
<a href="/">Clothes</a>
</li>
<li>
<a href="/">Electronics</a>
</li>
<li>
<a href="/">Furnitures</a>
</li>
<li>
<a href="/">Toys</a>
</li>
<li>
<a href="/">Others</a>
</li>
</ul>
</div>

<div class="navbar-right">
<ul>
<li class="navbar-email">[email protected]</li>
<li class="navbar-shopping-cart">
<img src="./icons/icon_shopping_cart.svg" alt="shopping cart">
<div>2</div>
</li>
</ul>
</div>

<!--Menu desktop-->
<div class="desktop-menu inactive">
<ul>
<li>
<a href="/" class="title">My orders</a>
</li>

<li>
<a href="/">My account</a>
</li>

<li>
<a href="/">Sign out</a>
</li>
</ul>
</div>

<!--Menu mobile-->
<div class="mobile-menu inactive">
<ul>
<li>
<a href="/">CATEGORIES</a>
</li>
<li>
<a href="/">All</a>
</li>
<li>
<a href="/">Clothes</a>
</li>
<li>
<a href="/">Electronics</a>
</li>
<li>
<a href="/">Furnitures</a>
</li>
<li>
<a href="/">Toys</a>
</li>
<li>
<a href="/">Other</a>
</li>
</ul>

<ul>
<li>
<a href="/">My orders</a>
</li>
<li>
<a href="/">My account</a>
</li>
</ul>

<ul>
<li>
<a href="/" class="email">[email protected]</a>
</li>
<li>
<a href="/" class="sign-out">Sign out</a>
</li>
</ul>
</div>
</nav>




<aside id="shoppingCartContainer" class="inactive">
<div class="title-container">
<img src="./icons/flechita.svg" alt="arrow">
<p class="title">My order</p>
</div>

<div class="my-order-content">
<div class="shopping-cart">
<figure>
<img src="https://images.pexels.com/photos/276517/pexels-photo-276517.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940" alt="bike">
</figure>
<p>Bike</p>
<p>$30,00</p>
<img src="./icons/icon_close.png" alt="close">
</div>

<div class="shopping-cart">
<figure>
<img src="https://images.pexels.com/photos/276517/pexels-photo-276517.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940" alt="bike">
</figure>
<p>Bike</p>
<p>$30,00</p>
<img src="./icons/icon_close.png" alt="close">
</div>

<div class="shopping-cart">
<figure>
<img src="https://images.pexels.com/photos/276517/pexels-photo-276517.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940" alt="bike">
</figure>
<p>Bike</p>
<p>$30,00</p>
<img src="./icons/icon_close.png" alt="close">
</div>

<div class="order">
<p>
<span>Total</span>
</p>
<p>$560.00</p>
</div>

<button class="primary-button">
Checkout
</button>
</div>
</div>
</aside>

<aside id="productDetail" class="">
<div class="product-detail-close">
<img src="./icons/icon_close.png" alt="close">
</div>
<img src="https://images.pexels.com/photos/276517/pexels-photo-276517.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940" alt="bike">
<div class="product-info">
<p>$35,00</p>
<p>Bike</p>
<p>With its practical position, this bike also fulfills a decorative function, add your hall or workspace.</p>
<button class="primary-button add-to-cart-button">
<img src="./icons/bt_add_to_cart.svg" alt="add to cart">
Add to cart
</button>
</div>
</aside>


<!--Listado de productos-->
<section class="main-container">
<div class="cards-container">

<!-- <div class="product-card">
<img src="https://images.pexels.com/photos/276517/pexels-photo-276517.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940" alt="">
<div class="product-info">
<div>
<p>$120,00</p>
<p>Bike</p>
</div>
<figure>
<img src="./icons/bt_add_to_cart.svg" alt="">
</figure>
</div>
</div> -->



</div>
</section>

<script src="main.js"></script>
</body>
</html>
118 changes: 118 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
const menuEmail = document.querySelector('.navbar-email');
const desktopMenu = document.querySelector('.desktop-menu');
const menuHamIcon = document.querySelector('.menu');
const mobileMenu = document.querySelector('.mobile-menu');
const menuCarritoIcon = document.querySelector('.navbar-shopping-cart');
const shoppingCartContainer = document.querySelector('#shoppingCartContainer');
const cardsContainer = document.querySelector('.cards-container');




menuEmail.addEventListener('click', toggleDesktopMenu);
menuHamIcon.addEventListener('click', toggleMobileMenu);
menuCarritoIcon.addEventListener('click', toggleCarritoAside);



function toggleDesktopMenu() {
const isAsaidClosed = shoppingCartContainer.classList.contains('inactive');
if (!isAsaidClosed) {
shoppingCartContainer.classList.add('inactive');
}
desktopMenu.classList.toggle('inactive');
}

function toggleMobileMenu() {
const isAsaidClosed = shoppingCartContainer.classList.contains('inactive');

if (!isAsaidClosed) {
shoppingCartContainer.classList.add('inactive');
}
mobileMenu.classList.toggle('inactive');
}

function toggleCarritoAside() {
const isMobileMenuClosed = mobileMenu.classList.contains('inactive');

if (!isMobileMenuClosed){
mobileMenu.classList.add('inactive');

}
shoppingCartContainer.classList.toggle('inactive');


}



const productList = [];
productList.push({
name: 'FAJC 5832',
precio: 24,
image: 'https://lh3.googleusercontent.com/4P9eskycIJHwokZ6p_0420LNjHGImMqxveKz2uHKjFnOkb2t2cOozzlr9KKxH05dQW7RH0fIDiZ04lLQ-5AWJk0kgkKn_4OVSOLf=w600',
})
productList.push({
name: 'FAJC 5833',
precio: 10,
image: 'https://lh3.googleusercontent.com/8II5BvLgWgC9C4EDomKV_f61zm1bvqf21173ydEFagWhojvUun8WTXJQ8Iq_-oewPqNzknGIiDpLcil3_sneeOF-RD5r5OaK-aaM=w600',
})
productList.push({
name: 'FAJC 5834',
precio: 40,
image: 'https://lh3.googleusercontent.com/59TM6D7ZjAIF_32eLG73HiX3yrACEo7ZbMTVIK5_F5sJ2DXzhbY2EB9AKgZEcERTBkqldp2-yIVT42myeNLscRp-su4YCL0FM6V1=w600',
})
productList.push({
name: 'FAJC 5836',
precio: 120,
image: 'https://lh3.googleusercontent.com/9vnsILutDDoPO6z0T06nLlaxNRgfI12Ea-FPDxMsap5XYTeehaBjNG9VUf7An5IsdXtS6vBH-R28Y0NQqslLP2nsSCYqJCe0UYnNTw=w600',
})
productList.push({
name: 'FAJC 5837',
precio: 40,
image: 'https://lh3.googleusercontent.com/oprzLI6Ffxi0eSWRoIcy5we4NB3aJ8CiFuzZBfRjA_mkEONyC_aoG32eHZ6TQb--I6bR9V9J-lp2YSgSscUc0MoXXh_lOFJyYpAM=w600',
})
productList.push({
name: 'FAJC 5839',
precio: 16,
image: 'https://lh3.googleusercontent.com/L4YR1Fq2kchlMJUinudpqgHF8X78TYowFyyjIlyfhop4klqWxPx5gMelyCoSR8lV1AX9sF2x_Q8hb7SQMPhHGpso9aQ81B6udSaimA=w600',
})

function renderProducts(arr){
for (product of arr) {
const productCard = document.createElement('div');
productCard.classList.add('product-card');

const productImg = document.createElement('img');
productImg.setAttribute('src', product.image);

const productInfo = document.createElement('div');
productInfo.classList.add('product-info');

const productInfoDiv = document.createElement('div');

const productPrice = document.createElement('p');
productPrice.innerText = '$' + product.precio;
const productName = document.createElement('p');
productName.innerText = product.name;

productInfoDiv.appendChild(productPrice);
productInfoDiv.appendChild(productName);

const porductInfoFigure = document.createElement('figure');
const porductImgCart = document.createElement('img');
porductImgCart.setAttribute('src','./icons/bt_add_to_cart.svg');

porductInfoFigure.appendChild(porductImgCart);

productInfo.appendChild(productInfoDiv);
productInfo.appendChild(porductInfoFigure);

productCard.appendChild(productImg);
productCard.appendChild(productInfo);

cardsContainer.appendChild(productCard);
}
}

renderProducts(productList);
Loading