Skip to content

Commit

Permalink
Merge pull request #15 from ChinchiGit/develop
Browse files Browse the repository at this point in the history
"Implemented smooth transitions for menu expansion and icon rotation in Nav component."
  • Loading branch information
ChinchiGit authored May 30, 2024
2 parents 6e5a30e + a93167e commit 1832431
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 26 deletions.
41 changes: 27 additions & 14 deletions src/components/Header/Nav/Nav.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
nav{
nav {
width: 100%;
background-color: rgba(28, 51, 97, 0.7);
display: flex;
Expand All @@ -8,31 +8,44 @@ nav{
line-height: 1.5;
font-weight: 400;
text-align: left;
border-radius:5px;
color:black;
border-radius: 5px;
color: black;
}

ul {
display: none;
display: flex;
flex-direction: column;
width: 80%;
background-color: #0c1618;
margin: 2%;
max-height: 0;
opacity: 0;
visibility: hidden;
overflow: hidden;
transition: max-height 0.4s ease-out, opacity 0.4s ease-out, visibility 0.4s;
}

input:checked~ul {
display: block;
max-height: 500px; /* Ajusta este valor según sea necesario */
opacity: 1;
visibility: visible;
}

#menu {
display: none;
}

#menu-icon{
#menu-icon {
margin-right: 20px;
color:white
color: white;
transition: transform 0.4s ease-out; /* Transición para la rotación */
}

#canIcon{
#menu-icon.rotate { /* Agregar clase 'rotate' para rotar */
transform: rotate(90deg);
}

#canIcon {
margin-left: 20px;
max-width: 45px;
max-height: 45px;
Expand All @@ -51,8 +64,8 @@ nav>div>label {
user-select: none;
}

nav>a{
color:black;
nav>a {
color: black;
}

li {
Expand All @@ -64,13 +77,13 @@ li {
border-bottom: 1px solid grey;
}

#smileIcon{
#smileIcon {
height: 40px;
}

#desplegable{
#desplegable {
display: flex;
flex-direction: row-reverse;
width: 100%;
align-items: flex-start
}
align-items: flex-start;
}
20 changes: 8 additions & 12 deletions src/components/Header/Nav/Nav.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { useState, useEffect, useRef } from "react";
import React, { useState, useEffect, useRef } from "react";
import { Link } from 'react-router-dom';
import { UserAuth } from "../../../context/AuthContext";
import "./Nav.css"


const Nav = () => {
const { user } = UserAuth();
const [isChecked, setIsChecked] = useState(false);
Expand Down Expand Up @@ -31,18 +30,17 @@ const Nav = () => {
return (
<>
<nav onMouseEnter={handleMouseEnter}>

<div>
<Link to='/login'><img id="canIcon" src="/assets/img/nav_icon01.png" alt="Logo GasolineHack" /></Link>
</div>
<div id="desplegable">
<input type="checkbox" id="menu" checked={isChecked} onChange={handleInputChange}/>
<label htmlFor="menu" id="menu-icon"></label>
<input type="checkbox" id="menu" checked={isChecked} onChange={handleInputChange} />
<label htmlFor="menu" id="menu-icon" className={isChecked ? "rotate" : ""}></label>
<ul>
<li ><Link to='/home'>HOME</Link></li>
<li ><Link to='/cercana'>GASOLINERA MAS CERCANA</Link></li>
<li ><Link to='/provincia'>BUSCAR POR PROVINCIA</Link></li>
<li ><Link to='/radio'>BUSCAR POR RADIO</Link></li>
<li><Link to='/home'>HOME</Link></li>
<li><Link to='/cercana'>GASOLINERA MAS CERCANA</Link></li>
<li><Link to='/provincia'>BUSCAR POR PROVINCIA</Link></li>
<li><Link to='/radio'>BUSCAR POR RADIO</Link></li>
{user &&
<>
<li><Link to='/misgasolineras'>MIS GASOLINERAS</Link></li>
Expand All @@ -52,10 +50,8 @@ const Nav = () => {
</ul>
</div>
</nav>

</>
)
);
};

export default Nav;

0 comments on commit 1832431

Please sign in to comment.