Skip to content

Commit

Permalink
Merge pull request #97 from Arquisoft/develop
Browse files Browse the repository at this point in the history
Añadido aboutus a navbar
  • Loading branch information
Verzidee authored Apr 28, 2024
2 parents 9197440 + 8fff131 commit 845d6f2
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 37 deletions.
3 changes: 1 addition & 2 deletions questionservice/wikiUtils/wikiQuery.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ describe("WikiQuery", () => {
{ questionLabel: { value: "¿Cuál es la capital de Francia?1" }, answerLabel: { value: "París1" } },
{ questionLabel: { value: "¿Cuál es la capital de Francia?2" }, answerLabel: { value: "París2" } },
{ questionLabel: { value: "¿Cuál es la capital de Francia?3" }, answerLabel: { value: "París3" } }
// Agrega más elementos según necesites para tu prueba
];

// Configurar wikiCall para retornar datos simulados
Expand Down Expand Up @@ -53,6 +52,6 @@ describe("WikiQuery", () => {

// Verifica que la cantidad de preguntas y sus formatos sean los esperados
expect(questions).toHaveLength(mockResults.length);

});
});
2 changes: 1 addition & 1 deletion webapp/src/components/Navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

.nav-menu {
display: grid;
grid-template-columns: repeat(6, auto);
grid-template-columns: repeat(8, auto);
grid-gap: 10px;
list-style: none;
width: 60vw;
Expand Down
77 changes: 43 additions & 34 deletions webapp/src/components/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,52 @@ function Navbar() {
}, []);

const NavLinks = ({ isLoggedIn }) => (
<ul className={isClicked ? 'nav-menu active' : 'nav-menu'}>
<li className='nav-item'>
<Link to='/' className='nav-links' onClick={closeMenu}>Inicio</Link>
</li>
{isLoggedIn ? (
<>
<li className='nav-item'>
<Link to='/jugar' className='nav-links' onClick={closeMenu} data-testid="Jugar-button-navbar">Jugar</Link>
</li>
<li className='nav-item'>
<Link to='/historial' className='nav-links' onClick={closeMenu} data-testid="historial-button-navbar">Historial</Link>
</li>
<li className='nav-item'>
<Link to='/ranking' className='nav-links' onClicks={closeMenu} data-testid="Ranking-button-navbar">Ranking</Link>
</li>
<li>
<Link to='/logout' className='nav-links-mobile' onClick={closeMenu} data-testid="Salir-button-navbar">Salir</Link>
</li>
</>
) : (
<>
<li>
<Link to='/sign-up' className='nav-links-mobile' onClick={closeMenu} data-testid="Registrarse-button-navbar">Registrarse</Link>
</li>
<li>
<Link to='/login' className='nav-links-mobile' onClick={closeMenu} data-testid="Entrar-button-navbar">Entrar</Link>
</li>
</>
)}
</ul>
<ul className={isClicked ? 'nav-menu active' : 'nav-menu'}>
<li className='nav-item'>
<Link to='/' className='nav-links' onClick={closeMenu}>Inicio</Link>
</li>
<li className='nav-item'>
<Link to='/abouts' className='nav-links' onClick={closeMenu}>About us</Link>
</li>
{isLoggedIn ? (
<>
<li className='nav-item'>
<Link to='/jugar' className='nav-links' onClick={closeMenu}
data-testid="Jugar-button-navbar">Jugar</Link>
</li>
<li className='nav-item'>
<Link to='/historial' className='nav-links' onClick={closeMenu}
data-testid="historial-button-navbar">Historial</Link>
</li>
<li className='nav-item'>
<Link to='/ranking' className='nav-links' onClicks={closeMenu}
data-testid="Ranking-button-navbar">Ranking</Link>
</li>
<li>
<Link to='/logout' className='nav-links-mobile' onClick={closeMenu}
data-testid="Salir-button-navbar">Salir</Link>
</li>
</>
) : (
<>
<li>
<Link to='/sign-up' className='nav-links-mobile' onClick={closeMenu}
data-testid="Registrarse-button-navbar">Registrarse</Link>
</li>
<li>
<Link to='/login' className='nav-links-mobile' onClick={closeMenu}
data-testid="Entrar-button-navbar">Entrar</Link>
</li>
</>
)}
</ul>
);

return (
<nav className='navbar'>
<div className='navbar-container'>
<Link to='/' className='navbar-logo' onClick={closeMenu}>WIQ<i className='fab fa-typo3' /></Link>
<div className='menu-icon' onClick={toggleClick}>
<nav className='navbar'>
<div className='navbar-container'>
<Link to='/' className='navbar-logo' onClick={closeMenu}>WIQ<i className='fab fa-typo3'/></Link>
<div className='menu-icon' onClick={toggleClick}>
<button aria-label="Menu toggle" data-testid="Menu-toggle-button">
<i className={isClicked ? 'fas fa-times' : 'fas fa-bars'}/>
</button>
Expand Down
1 change: 1 addition & 0 deletions webapp/src/components/Navbar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe('Componente Navbar', () => {
renderNavbar(true);

expect(screen.getByRole('link', { name: 'Inicio' })).toBeInTheDocument();
expect(screen.getByRole('link', { name: 'About us' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Salir' })).toBeInTheDocument();
expect(screen.getByRole('link', { name: 'Historial' })).toBeInTheDocument();
expect(screen.getByRole('link', { name: 'Jugar' })).toBeInTheDocument();
Expand Down

0 comments on commit 845d6f2

Please sign in to comment.