This commit is contained in:
2025-12-21 20:40:32 +01:00
commit c7f669fc11
54 changed files with 7575 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import { useEffect } from "react";
import { useLocation } from "react-router-dom";
export default function ScrollToTop() {
const { pathname, hash } = useLocation();
useEffect(() => {
if (hash) {
// Use setTimeout to allow DOM to render if navigating from another page
setTimeout(() => {
const element = document.getElementById(hash.replace('#', ''));
if (element) {
element.scrollIntoView({ behavior: 'smooth' });
}
}, 100);
} else {
window.scrollTo(0, 0);
}
}, [pathname, hash]);
return null;
}