Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Añadido aboutus a navbar #97

Merged
merged 4 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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