fix(scroll)
This commit is contained in:
1 parent
185939fe9e
commit
0524c26d8a
3 files changed
+7969
No files matched your search
+7955
File diff suppressed because it is too large.
Load diff
@@ -2,6 +2,7 @@ import { Routes, Route } from 'react-router';
|
|||||||
import { Navbar } from './components/Navbar';
|
import { Navbar } from './components/Navbar';
|
||||||
import { Footer } from './components/Footer';
|
import { Footer } from './components/Footer';
|
||||||
import { FloatingButtons } from './components/FloatingButtons';
|
import { FloatingButtons } from './components/FloatingButtons';
|
||||||
|
import { ScrollToTop } from './components/ScrollToTop';
|
||||||
import { CookieBanner } from './components/CookieBanner';
|
import { CookieBanner } from './components/CookieBanner';
|
||||||
import { Home } from './pages/Home';
|
import { Home } from './pages/Home';
|
||||||
import { SobreNosotros } from './pages/SobreNosotros';
|
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"
|
className="min-h-screen overflow-x-hidden font-sans transition-colors duration-500"
|
||||||
style={{ background: '#f9f9f7' }}
|
style={{ background: '#f9f9f7' }}
|
||||||
>
|
>
|
||||||
|
<ScrollToTop />
|
||||||
<Navbar onOpenContact={openContact} />
|
<Navbar onOpenContact={openContact} />
|
||||||
|
|
||||||
<Routes>
|
<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