[Agregar] responsive design al menu, se crearon los archivos de estilos para el componente del navbar

This commit is contained in:
francisco-solis99 2021-10-08 19:53:35 -05:00
parent ad910843c2
commit 0ca1f0b1d4
6 changed files with 223 additions and 146 deletions

View file

@ -1,3 +1,4 @@
'use strict';
const controlMenu = document.querySelector('#control-menu');
const menu = document.querySelector('#menu');
const overlay = document.querySelector('.overlay');

View file

@ -0,0 +1,70 @@
.overlay,
.nav__item-logo,
.nav__burger-icon {
display: none;
}
.nav__menu {
position: initial;
width: auto;
flex-direction: row;
justify-content: center;
background-color: initial;
}
.nav__logo-wrapper {
width: 20%;
max-width: 136px;
max-height: 60px;
}
.nav__item {
margin: 0 10px;
padding: 0;
}
.nav__item:nth-child(3) {
margin-right: 0;
order: 3;
}
.nav__item:last-child {
order: 2;
}
.nav__item a {
padding: 10px 15px;
border-radius: 40px;
}
.nav__item:nth-child(2) a {
padding: 0;
}
.nav__item:nth-child(3) a {
font-weight: bold;
color: var(--color-secondary-purple);
border: 2px solid var(--color-secondary-purple);
transition: all ease-in 300ms;
}
.nav__item:nth-child(3) a:hover {
background-color: rgba(130, 135, 222, .2);
}
.nav__item:last-child a {
background-color: var(--color-primary-red);
color: var(--color-background);
}
.nav__item:active {
background-color: initial;
transform: scale(1.1);
}
.nav__item span {
display: none;
}

View file

@ -0,0 +1,142 @@
/* Estilos al menu */
.nav {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 30px;
padding-bottom: 40px;
background-color: var(--color-background);
}
.nav__logo-wrapper {
display: flex;
align-items: center;
}
.nav__logo{
width: 100%;
}
.nav__burger-icon {
background-image: url("../../../icons/burger-icon.svg");
width: 14px;
height: 14px;
cursor: pointer;
}
/* Estilos para menú */
.nav__menu {
width: 65%;
display: flex;
flex-direction: column;
justify-content: center;
position: fixed;
left: -85%;
top: 0;
bottom: 0;
list-style: none;
background-color: #FFF;
transition: all ease-in-out 600ms;
}
.nav__menu-isactive {
left: 0;
transition: all ease-in-out 600ms;
z-index: 1;
}
.nav__item-logo {
width: 80%;
margin: 0 auto;
margin-bottom: 50px;
}
.nav__item--logo a {
display: block;
}
.nav__item {
/* background-color: hsla(237, 58%, 69%, 0.4); */
display: flex;
align-items: center;
height: auto;
padding: 3px 20px;
margin-bottom: 15px;
gap: 0 10px;
position: relative;
}
.nav__item-isactive {
background-color: hsla(237, 58%, 69%, 0.4);
}
.nav__item-isactive::before {
content: '';
display: block;
position: absolute;
left: 0;
height: 100%;
width: 5px;
background-color: var(--color-secondary-purple);
}
.nav__item-tab {
display: block;
}
.nav__item:active {
background-color: hsla(237, 58%, 69%, 0.4);
}
.nav__item a {
font-size: 1.4rem;
font-weight: 500;
text-decoration: none;
color: #000;
}
.nav__item span {
display: block;
width: 16px;
height: 16px;
background-position: center;
background-repeat: no-repeat;
}
.nav__item:nth-child(2) span {
background-image: url('../../../icons/articles-icon.svg');
}
.nav__item:nth-child(3) span {
background-image: url('../../../icons/login-icon.svg');
}
.nav__item:nth-child(4) span {
background-image: url('../../../icons/write-icon.svg');
}
/* Estilos para la visualizacion del menu */
.overlay {
opacity: 0;
position: fixed;
top: 0;
left: 0;
width: 10px;
height: 10px;
border-radius: 50%;
background-color: rgba(0, 0, 0, 0.5);
transition: all 400ms linear;
}
.overlay__is-active {
opacity: 1;
border-radius: 0;
width: 100%;
height: 100%;
}
.stop-scrolling {
height: 100vh;
overflow: hidden;
}

View file

@ -47,3 +47,4 @@
width: 40%;
}
/* Estilos para la seccion de los post mas populares */

View file

@ -20,149 +20,6 @@ body {
background-color: var(--color-background);
}
/* Estilos al menu */
.nav {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 30px;
padding-bottom: 40px;
background-color: var(--color-background);
}
.nav__logo-wrapper {
display: flex;
align-items: center;
}
.nav__logo{
width: 100%;
}
.nav__burger-icon {
background-image: url("../../../icons/burger-icon.svg");
width: 14px;
height: 14px;
cursor: pointer;
}
/* Estilos para menú */
.nav__menu {
width: 65%;
display: flex;
flex-direction: column;
justify-content: center;
position: fixed;
left: -85%;
top: 0;
bottom: 0;
list-style: none;
background-color: #FFF;
transition: all ease-in-out 600ms;
}
.nav__menu-isactive {
left: 0;
transition: all ease-in-out 600ms;
z-index: 1;
}
.nav__item-logo {
width: 80%;
margin: 0 auto;
margin-bottom: 50px;
}
.nav__item--logo a {
display: block;
}
.nav__item {
/* background-color: hsla(237, 58%, 69%, 0.4); */
display: flex;
align-items: center;
height: auto;
padding: 3px 20px;
margin-bottom: 15px;
gap: 0 10px;
position: relative;
}
.nav__item-isactive {
background-color: hsla(237, 58%, 69%, 0.4);
}
.nav__item-isactive::before {
content: '';
display: block;
position: absolute;
left: 0;
height: 100%;
width: 5px;
background-color: var(--color-secondary-purple);
}
.nav__item-tab {
display: block;
}
.nav__item:active {
background-color: hsla(237, 58%, 69%, 0.4);
}
.nav__item a {
font-size: 1.4rem;
font-weight: 500;
text-decoration: none;
color: #000;
}
.nav__item span {
display: block;
width: 16px;
height: 16px;
background-position: center;
background-repeat: no-repeat;
}
.nav__item:nth-child(2) span {
background-image: url('../../../icons/articles-icon.svg');
}
.nav__item:nth-child(3) span {
background-image: url('../../../icons/login-icon.svg');
}
.nav__item:nth-child(4) span {
background-image: url('../../../icons/write-icon.svg');
}
/* Estilos para la visualizacion del menu */
.overlay {
opacity: 0;
position: fixed;
top: 0;
left: 0;
width: 10px;
height: 10px;
border-radius: 50%;
background-color: rgba(0, 0, 0, 0.5);
transition: all 400ms linear;
}
.overlay__is-active {
opacity: 1;
border-radius: 0;
width: 100%;
height: 100%;
}
.stop-scrolling {
height: 100vh;
overflow: hidden;
}
/* Estilos para el hero */
.hero {
display: flex;
@ -173,7 +30,6 @@ body {
.hero__img-wrapper {
width: 100%;
margin-bottom: 30px;
}
.hero__img {

View file

@ -1,23 +1,30 @@
<?php defined('NABU') || exit() ?>
<?php $head_title = NABU_DEFAULT['website-name'] ?>
<!-- Estilos cargados -->
<?php $styles = array(
'components/navbar/navbar.css',
'components/articles/articles.css',
'components/footer/footer.css',
'pages/home/home.css',
) ?>
<!-- Estilos para el responsive design -->
<?php $desktop_styles = array(
array('pages/home/home-desktop.css', 'attributes' => 'media="screen and (min-width: 600px)"'),
array('components/navbar/navbar-desktop.css', 'attributes' => 'media="screen and (min-width: 650px)"'),
array('pages/home/home-desktop.css', 'attributes' => 'media="screen and (min-width: 650px)"'),
) ?>
<!-- Archivos de javascript -->
<?php $scripts = array(
'home.js',
) ?>
<!-- Componente head -->
<?php require_once 'views/components/head.php' ?>
<header class="header">
<?php require_once 'views/components/navbar.php' ?>
<div class="hero">
<picture class="hero__img-wrapper">
<source srcset="<?= NABU_DIRECTORY['images'] ?>/hero-desktop.png" media="(min-width: 600px)">
<source srcset="<?= NABU_DIRECTORY['images'] ?>/hero-desktop.png" media="(min-width: 500px)">
<img src="<?= NABU_DIRECTORY['images'] ?>/hero.png" alt="Imagen inspiración en cualquier momento y cualquier lugar" class="hero__img">
</picture>
<div class="hero__text-container">