Segue o código desenvolvido em aula: HTML:
<!DOCTYPE html>
<html lang="pt-br">
<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 rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap">
<link rel="stylesheet" href="assets/css/reset.css">
<link rel="stylesheet" href="assets/css/styles.css">
<title>HZC | Home</title>
</head>
<body>
<header class="header">
<button class="header__menu" aria-label="menu"><i></i></button>
<img class="header__logo" src="assets/img/logo.svg" alt="Logotipo da HZC">
<button class="header__noti" aria-label="notificação"><i></i></button>
</header>
<nav class="side-menu ">
<img src="assets/img/logo.svg" alt="logotipo da HZC" class="side-logo">
<a href="#" class="side-menu__link side-menu__link--inicio side-menu__link--ativo">Inicio</a>
<a href="#" class="side-menu__link side-menu__link--videos">Videos</a>
<a href="#" class="side-menu__link side-menu__link--picos">Picos</a>
<a href="#" class="side-menu__link side-menu__link--integrantes">Integrantes</a>
<a href="#" class="side-menu__link side-menu__link--camisas">Camisas</a>
<a href="#" class="side-menu__link side-menu__link--pinturas">Pinturas</a>
</nav>
<script src="assets/js/index.js"></script>
</body>
</html>
CSS:
@font-face {
font-family: 'icones';
src: url(../font/icones.ttf);
}
body {
background-color: #1D232A;
font-family: 'Open Sans', 'icones', sans-serif;
color: #FFFFFF;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
background-color: #15191C;
padding: 8px 16px;
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.16);
}
.header__menu i::before {
content: "\e904";
font-size: 24px;
}
.header__logo {
width: 40px;
}
.header__noti::before {
content: "\e906";
font-size: 24px;
}
.side-menu {
display: flex;
flex-direction: column;
background-color: #15191C;
width: 75vw;
height: 100vh;
position: absolute;
left: -100vw;
transition: .75s;
}
.side-menu--ativo {
left: 0;
transition: .75s;
}
.side-logo {
width: 118px;
padding: 16px;
align-self: center;
}
.side-menu__link {
height: 64px;
color: #95999C;
padding-left: 64px;
display: flex;
align-items: center;
}
.side-menu__link--ativo {
color: #FFFFFF;
padding-left: 56px;
border-left: 8px solid #FFFFFF;
}
.side-menu__link::before {
width: 24px;
height: 24px;
font-size: 24px;
position: absolute;
left: 24px;
}
.side-menu__link--inicio::before {
content: "\e902";
}
.side-menu__link--videos::before {
content: "\e90e";
}
.side-menu__link--picos::before {
content: "\e909";
}
.side-menu__link--integrantes::before {
content: "\e903";
}
.side-menu__link--camisas::before {
content: "\e900";
}
.side-menu__link--pinturas::before {
content: "\e90a";
}
JS:
const btn_menu = document.querySelector(".header__menu");
const menu = document.querySelector(".side-menu");
btn_menu.addEventListener('click', () => {
menu.classList.toggle('side-menu--ativo');
});