forked from platzi/curso-frontend-developer-practico
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clase platzi#19 Fusión del menú desktop... Clase de utilidad para ent…
…ender cómo funciona el .toggle
- Loading branch information
Showing
3 changed files
with
208 additions
and
0 deletions.
There are no files selected for viewing
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,70 @@ | ||
<!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"> | ||
<link rel="stylesheet" href="./style.css"> | ||
<title>Yardsale: tienda online</title> | ||
</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" for="email">platzi@example.com</li> | ||
<li class="navbar-shopping-cart"> | ||
<img src="./icons/icon_shopping_cart.svg" alt="shopping cart"> | ||
<div>2</div> | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
<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> | ||
</nav> | ||
</body> | ||
<script src="./main.js"></script> | ||
</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,8 @@ | ||
const nav_bar = document.querySelector(".navbar-email") | ||
const nav_email = document.querySelector(".desktop-menu") | ||
|
||
function quitarInactive(){ | ||
nav_email.classList.toggle ("inactive") | ||
} | ||
|
||
nav_bar.addEventListener("click", quitarInactive) |
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,130 @@ | ||
: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; | ||
} | ||
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); | ||
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; | ||
} | ||
|
||
.desktop-menu { | ||
position: absolute; | ||
width: 100px; | ||
height: auto; | ||
border: 1px solid var(--very-light-pink); | ||
border-radius: 0px 0px 6px 6px; | ||
padding: 20px 20px 0 20px; | ||
background: var(--white); | ||
top: 60px; | ||
right: 58px; | ||
} | ||
.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; | ||
} | ||
|
||
@media (max-width: 640px) { | ||
.menu { | ||
display: block; | ||
} | ||
.navbar-left ul { | ||
display: none; | ||
} | ||
.navbar-email { | ||
display: none; | ||
} | ||
} | ||
|