fix(scroll)
This commit is contained in:
1 parent
185939fe9e
commit
0524c26d8a
3 files changed
+7969
No files matched your search
@@ -2,6 +2,7 @@ import { Routes, Route } from 'react-router';
|
||||
import { Navbar } from './components/Navbar';
|
||||
import { Footer } from './components/Footer';
|
||||
import { FloatingButtons } from './components/FloatingButtons';
|
||||
import { ScrollToTop } from './components/ScrollToTop';
|
||||
import { CookieBanner } from './components/CookieBanner';
|
||||
import { Home } from './pages/Home';
|
||||
import { SobreNosotros } from './pages/SobreNosotros';
|
||||
@@ -23,6 +24,7 @@ export default function App() {
|
||||
className="min-h-screen overflow-x-hidden font-sans transition-colors duration-500"
|
||||
style={{ background: '#f9f9f7' }}
|
||||
>
|
||||
<ScrollToTop />
|
||||
<Navbar onOpenContact={openContact} />
|
||||
|
||||
<Routes>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useLocation } from 'react-router';
|
||||
|
||||
export const ScrollToTop = () => {
|
||||
const { pathname } = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
window.scrollTo(0, 0);
|
||||
}, [pathname]);
|
||||
|
||||
return null;
|
||||
};
|
||||
Reference in new issue
Block a user