diff --git a/icons/pexels-photo-276517.webp b/icons/pexels-photo-276517.webp new file mode 100644 index 000000000..b55e9e87d Binary files /dev/null and b/icons/pexels-photo-276517.webp differ diff --git a/index2.html b/index2.html new file mode 100644 index 000000000..8e91d429a --- /dev/null +++ b/index2.html @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + YardSale: tienda online de cositas chidas + + + + + + + + +
+
+ + + +
+
+ + + + diff --git a/logos/pexels-photo-276517.webp b/logos/pexels-photo-276517.webp new file mode 100644 index 000000000..b55e9e87d Binary files /dev/null and b/logos/pexels-photo-276517.webp differ diff --git a/main.js b/main.js index 7ebb1bb3e..ef87b0a1a 100644 --- a/main.js +++ b/main.js @@ -77,8 +77,8 @@ productList.push({ image: 'https://images.pexels.com/photos/276517/pexels-photo-276517.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940', }); -function renderProducts(arr) { - for (product of arr) { +function renderProducts(products) { + for (product of products) { const productCard = document.createElement('div'); productCard.classList.add('product-card'); @@ -117,3 +117,4 @@ function renderProducts(arr) { } renderProducts(productList); +console.log(productList); \ No newline at end of file diff --git a/main2.js b/main2.js new file mode 100644 index 000000000..5c23c8c52 --- /dev/null +++ b/main2.js @@ -0,0 +1,132 @@ +const menuEmail = document.querySelector('.navbar-email'); +const menuHamIcon = document.querySelector('.menu'); +const menuCarritoIcon = document.querySelector('.navbar-shopping-cart'); +const productDetailCloseIcon = document.querySelector('.product-detail-close') +const desktopMenu = document.querySelector('.desktop-menu'); +const mobileMenu = document.querySelector('.mobile-menu'); +const shoppingCartContainer = document.querySelector('#shoppingCartContainer'); +const productDetailContainer = document.querySelector('#productDetail'); +const cardsContainer = document.querySelector('.cards-container'); + +menuEmail.addEventListener('click', toggleDesktopMenu); +menuHamIcon.addEventListener('click', toggleMobileMenu); +menuCarritoIcon.addEventListener('click', toggleCarritoAside); +productDetailCloseIcon.addEventListener('click', closeProductDetailAside); + +function toggleDesktopMenu() { + const isAsideClosed = shoppingCartContainer.classList.contains('inactive'); + + if (!isAsideClosed) { + shoppingCartContainer.classList.add('inactive'); + } + + desktopMenu.classList.toggle('inactive'); + + const isProductDetailClosed = productDetailContainer.classList.contains('inactive'); + + if (!isProductDetailClosed) { + productDetailContainer.classList.add('inactive'); + } +} + +function toggleMobileMenu() { + const isAsideClosed = shoppingCartContainer.classList.contains('inactive'); + + if (!isAsideClosed) { + shoppingCartContainer.classList.add('inactive'); + } + + closeProductDetailAside(); + + mobileMenu.classList.toggle('inactive'); +} + +function toggleCarritoAside() { + const isMobileMenuClosed = mobileMenu.classList.contains('inactive'); + + if (!isMobileMenuClosed) { + mobileMenu.classList.add('inactive'); + } + + const isProductDetailClosed = productDetailContainer.classList.contains('inactive'); + + if (!isProductDetailClosed) { + productDetailContainer.classList.add('inactive'); + } + + const isDesktopMenuClosed = desktopMenu.classList.contains('inactive'); + + if (!isDesktopMenuClosed) { + desktopMenu.classList.add('inactive'); + } + shoppingCartContainer.classList.toggle('inactive'); + + +} + +function openProductDetailAside() { + shoppingCartContainer.classList.add('inactive'); + productDetailContainer.classList.remove('inactive'); +} + +function closeProductDetailAside() { + productDetailContainer.classList.add('inactive'); +} + +const productList = []; +productList.push({ + name: 'Bike', + price: 120, + image: 'https://images.pexels.com/photos/276517/pexels-photo-276517.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940', +}); +productList.push({ + name: 'Pantalla', + price: 220, + image: 'https://images.pexels.com/photos/276517/pexels-photo-276517.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940', +}); +productList.push({ + name: 'Compu', + price: 620, + image: 'https://images.pexels.com/photos/276517/pexels-photo-276517.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940', +}); + +function renderProducts(arr) { + for (product of arr) { + const productCard = document.createElement('div'); + productCard.classList.add('product-card'); + + // product= {name, price, image} -> product.image + const productImg = document.createElement('img'); + productImg.setAttribute('src', product.image); + productImg.addEventListener('click', openProductDetailAside); + + const productInfo = document.createElement('div'); + productInfo.classList.add('product-info'); + + const productInfoDiv = document.createElement('div'); + + const productPrice = document.createElement('p'); + productPrice.innerText = '$' + product.price; + const productName = document.createElement('p'); + productName.innerText = product.name; + + productInfoDiv.appendChild(productPrice); + productInfoDiv.appendChild(productName); + + const productInfoFigure = document.createElement('figure'); + const productImgCart = document.createElement('img'); + productImgCart.setAttribute('src', './icons/bt_add_to_cart.svg'); + + productInfoFigure.appendChild(productImgCart); + + productInfo.appendChild(productInfoDiv); + productInfo.appendChild(productInfoFigure); + + productCard.appendChild(productImg); + productCard.appendChild(productInfo); + + cardsContainer.appendChild(productCard); + } +} + +renderProducts(productList); diff --git a/sfsdfsdfds b/sfsdfsdfds new file mode 100644 index 000000000..cacd38a04 --- /dev/null +++ b/sfsdfsdfds @@ -0,0 +1,84 @@ +commit 4766bd788af85dbce920ef1f7d9e489a013c48ff (HEAD -> main) +Merge: 1177f0c c090522 +Author: miguel <48770448+Miguel94666@users.noreply.github.com> +Date: Fri Apr 19 00:22:21 2024 -0700 + + bueno2 + +commit 1177f0cd160414dd1490fc14837eee4969146616 +Author: miguel <48770448+Miguel94666@users.noreply.github.com> +Date: Fri Apr 19 00:20:59 2024 -0700 + + bueno2 + +commit c090522fd7e4aed39a1302a4229cee2a5b611037 (origin/main, origin/HEAD) +Author: miguel <48770448+Miguel94666@users.noreply.github.com> +Date: Thu Apr 18 15:07:16 2024 -0700 + + commit del bueno + +commit 71fe133be397ad72e358fe516dab5d0117af8b11 +Author: miguel <48770448+Miguel94666@users.noreply.github.com> +Date: Wed Apr 17 20:25:28 2024 -0700 + + clase buena + +commit c99166754243d4de6a1259dc376c96c3ae935d5f +Author: Juan David Castro +Date: Wed May 25 10:47:21 2022 -0500 + + final code + +commit 74e35310d43b8d42bad4b636356dce5fe3a70a08 +Author: Juan David Castro +Date: Wed May 25 10:31:40 2022 -0500 + + product detail + +commit 11c672c1facc262ea3c11ecc8d95e1f0b0e67a0b +Author: Juan David Castro +Date: Tue May 24 13:10:35 2022 -0500 + + lista de productos + +commit cd8c453322192993b167784a1eaf57bb21c626b1 +Author: Juan David Castro +Date: Tue May 24 12:38:16 2022 -0500 + + carrito + +commit 9e37fee28e0819bd085fadb6e781d38994f2a520 +Author: Juan David Castro +Date: Tue May 24 12:14:37 2022 -0500 + + fusion menu mobile + +commit 1052fcd9e98d3e303a86da22141641e36dcdd5c5 +Author: Juan David Castro +Date: Tue May 24 11:57:23 2022 -0500 + + fusion menu desktop + +commit 5ca774e6f3d829de5a57a846c92d69f1d5be745b +Author: Juan David Castro +Date: Tue May 24 11:27:25 2022 -0500 + + Analizando el codigo de Teff + +commit 4774124de4c723d46d6a22da4c93c03f7be9e7bd +Author: Juan David Castro +Date: Fri Aug 6 10:22:19 2021 -0500 + + Add files via upload + +commit 84bc21bb1cb013e03a0c6d694b632aeec8a77977 +Author: Juan David Castro +Date: Thu Aug 5 16:50:27 2021 -0500 + + Add files via upload + +commit 06d2ccd2293a68614a14db757d1dc3477403e89f +Author: Juan David Castro +Date: Mon Aug 2 22:38:03 2021 -0500 + + Initial commit diff --git a/style2.css b/style2.css new file mode 100644 index 000000000..7228eedc8 --- /dev/null +++ b/style2.css @@ -0,0 +1,380 @@ +/* General */ +:root { + --white: #FFFFFF; + --black: #000000; + --very-light-pink: #C7C7C7; + --text-input-field: #F7F7F7; + --hospital-green: #ACD9B2; + --sm: 14px; + --md: 16px; + --lg: 18px; +} +body { + margin: 0; + font-family: 'Quicksand', sans-serif; +} +.inactive { + display: none; +} + + +/* Navbar (general) */ +nav { + display: flex; + justify-content: space-between; + padding: 0 24px; + border-bottom: 1px solid var(--very-light-pink); +} +.menu { + display: none; +} +.logo { + width: 100px; +} +.navbar-left ul, +.navbar-right ul { + list-style: none; + padding: 0; + margin: 0; + display: flex; + align-items: center; + height: 60px; +} +.navbar-left { + display: flex; +} +.navbar-left ul { + margin-left: 12px; +} +.navbar-left ul li a, +.navbar-right ul li a { + text-decoration: none; + color: var(--very-light-pink); + border: 1px solid var(--white); + padding: 8px; + border-radius: 8px; +} +.navbar-left ul li a:hover, +.navbar-right ul li a:hover { + border: 1px solid var(--hospital-green); + color: var(--hospital-green); +} +.navbar-email { + color: var(--very-light-pink); + cursor: pointer; + font-size: var(--sm); + margin-right: 12px; +} +.navbar-shopping-cart { + position: relative; +} +.navbar-shopping-cart div { + width: 16px; + height: 16px; + background-color: var(--hospital-green); + border-radius: 50%; + font-size: var(--sm); + font-weight: bold; + position: absolute; + top: -6px; + right: -3px; + display: flex; + justify-content: center; + align-items: center; +} + +/* Menu en desktop */ +.desktop-menu { + position: absolute; + top: 60px; + right: 60px; + background: var(--white); + width: 100px; + height: auto; + border: 1px solid var(--very-light-pink); + border-radius: 6px; + padding: 20px 20px 0 20px; +} +.desktop-menu ul { + list-style: none; + padding: 0; + margin: 0; +} +.desktop-menu ul li { + text-align: end; +} +.desktop-menu ul li:nth-child(1), +.desktop-menu ul li:nth-child(2) { + font-weight: bold; +} +.desktop-menu ul li:last-child { + padding-top: 20px; + border-top: 1px solid var(--very-light-pink); +} +.desktop-menu ul li:last-child a { + color: var(--hospital-green); + font-size: var(--sm); +} +.desktop-menu ul li a { + color: var(--back); + text-decoration: none; + margin-bottom: 20px; + display: inline-block; +} + +/* Menu en mobile */ +.mobile-menu { + background-color: var(--white); + position: absolute; + top: 60px; + left: 0; + width: 100%; + padding: 24px; +} +.mobile-menu a { + text-decoration: none; + color: var(--black); + font-weight: bold; + /* margin-bottom: 24px; */ +} +.mobile-menu ul { + padding: 0; + margin: 24px 0 0; + list-style: none; +} +.mobile-menu ul:nth-child(1) { + border-bottom: 1px solid var(--very-light-pink); +} +.mobile-menu ul li { + margin-bottom: 24px; +} +.email { + font-size: var(--sm); + font-weight: 300 !important; +} +.sign-out { + font-size: var(--sm); + color: var(--hospital-green) !important; +} + + +/* Aside (product detail y carrito) */ +aside { + background-color: var(--white); + width: 360px; + box-sizing: border-box; + position: absolute; + right: 0; +} + +/* ShoppingCart */ +#shoppingCartContainer { + padding: 0 24px; +} +.title-container { + display: flex; +} +.title-container img { + transform: rotate(180deg); + margin-right: 14px; +} +.title { + font-size: var(--lg); + font-weight: bold; +} +.order { + display: grid; + grid-template-columns: auto 1fr; + gap: 16px; + align-items: center; + background-color: var(--text-input-field); + margin-bottom: 24px; + border-radius: 8px; + padding: 0 24px; +} +.order p:nth-child(1) { + display: flex; + flex-direction: column; +} +.order p span:nth-child(1) { + font-size: var(--md); + font-weight: bold; +} +.order p:nth-child(2) { + text-align: end; + font-weight: bold; +} +.shopping-cart { + display: grid; + grid-template-columns: auto 1fr auto auto; + gap: 16px; + margin-bottom: 24px; + align-items: center; +} +.shopping-cart figure { + margin: 0; +} +.shopping-cart figure img { + width: 70px; + height: 70px; + border-radius: 20px; + object-fit: cover; +} +.shopping-cart p:nth-child(2) { + color: var(--very-light-pink); +} +.shopping-cart p:nth-child(3) { + font-size: var(--md); + font-weight: bold; +} +.primary-button { + background-color: var(--hospital-green); + border-radius: 8px; + border: none; + color: var(--white); + width: 100%; + cursor: pointer; + font-size: var(--md); + font-weight: bold; + height: 50px; +} + +/* ProductDetail */ +.product-detail-close { + background: var(--white); + width: 14px; + height: 14px; + position: absolute; + top: 24px; + left: 24px; + z-index: 2; + padding: 12px; + border-radius: 50%; +} +.product-detail-close:hover { + cursor: pointer; +} +#productDetail > img:nth-child(2) { + width: 100%; + height: 360px; + object-fit: cover; + border-radius: 0 0 20px 20px; +} +#productDetail .product-info { + margin: 24px 24px 0 24px; +} +#productDetail .product-info p:nth-child(1) { + font-weight: bold; + font-size: var(--md); + margin-top: 0; + margin-bottom: 4px; +} +#productDetail .product-info p:nth-child(2) { + color: var(--very-light-pink); + font-size: var(--md); + margin-top: 0; + margin-bottom: 36px; +} +#productDetail .product-info p:nth-child(3) { + color: var(--very-light-pink); + font-size: var(--sm); + margin-top: 0; + margin-bottom: 36px; +} +.primary-button { + background-color: var(--hospital-green); + border-radius: 8px; + border: none; + color: var(--white); + width: 100%; + cursor: pointer; + font-size: var(--md); + font-weight: bold; + height: 50px; +} +.add-to-cart-button { + display: flex; + align-items: center; + justify-content: center; +} + + +/* Product List */ +.cards-container { + display: grid; + grid-template-columns: repeat(auto-fill, 240px); + gap: 26px; + place-content: center; + margin-top: 20px; +} +.product-card { + width: 240px; +} +.product-card img { + width: 240px; + height: 240px; + border-radius: 20px; + object-fit: cover; +} +.product-card .product-info { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 12px; +} +.product-card .product-info figure { + margin: 0; +} +.product-card .product-info figure img { + width: 35px; + height: 35px; +} +.product-card .product-info div p:nth-child(1) { + font-weight: bold; + font-size: var(--md); + margin-top: 0; + margin-bottom: 4px; +} +.product-card .product-info div p:nth-child(2) { + font-size: var(--sm); + margin-top: 0; + margin-bottom: 0; + color: var(--very-light-pink); +} + + +@media (max-width: 640px) { + .menu { + display: block; + } + .navbar-left ul { + display: none; + } + .navbar-email { + display: none; + } + .desktop-menu { + display: none; + } + + aside { + width: 100%; + } + + .cards-container { + grid-template-columns: repeat(auto-fill, 140px); + } + .product-card { + width: 140px; + } + .product-card img { + width: 140px; + height: 140px; + } +} + +@media (min-width: 641px) { + .mobile-menu { + display: none; + } +}