Skip to content

Commit

Permalink
update Nav
Browse files Browse the repository at this point in the history
  • Loading branch information
vinib96 committed Jun 3, 2024
1 parent fbd437d commit 37c839f
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions Frontend/src/components/Nav.jsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,49 @@
import './Nav.css';
import { Link, useNavigate } from 'react-router-dom';
function Nav({ menuOpen, setMenuOpen }) {
const navigate = useNavigate();

const handleClick = (path) => {
setMenuOpen(false);
navigate(path);
};
import { Link } from 'react-router-dom';

function Nav({ menuOpen, setMenuOpen }) {
const handleScrollToFooter = () => {
setMenuOpen(false);
() => setMenuOpen(false);
const footer = document.getElementById('footer');
if (footer) {
footer.scrollIntoView({ behavior: 'smooth' });
} else {
console.error('Footer not found');
}
};

return (
<nav>
<ul className={menuOpen ? 'header__hamburger' : 'nav'}>
<li className='nav__li'>
<button className='nav__link' onClick={() => handleClick('/store')}>
<Link
className='nav__link'
to='/store'
onClick={() => setMenuOpen(false)}
>
LOJA
</button>
</Link>
</li>
<li className='nav__li'>
<button className='nav__link' onClick={() => handleClick('/sobre')}>
<Link
className='nav__link'
to='/sobre'
onClick={() => setMenuOpen(false)}
>
SOBRE
</button>
</Link>
</li>
<li className='nav__li'>
<button className='nav__link' onClick={() => handleClick('/maps')}>
<Link
className='nav__link'
to='/maps'
onClick={() => setMenuOpen(false)}
>
PONTOS DE COLETA
</button>
</Link>
</li>
<li className='nav__li'>
<button className='nav__link' onClick={handleScrollToFooter}>
<button onClick={handleScrollToFooter} className='nav__link'>
CONTATO
</button>
</li>
Expand Down

0 comments on commit 37c839f

Please sign in to comment.