feat: loading bar for pages

This commit is contained in:
Julien Froidefond
2025-02-21 15:54:52 +01:00
parent 284ccc58d9
commit 7b950f8729
4 changed files with 186 additions and 1 deletions

View File

@@ -106,13 +106,17 @@ export function Sidebar({ isOpen, onClose }: SidebarProps) {
};
const handleLinkClick = useCallback(
(path: string) => {
async (path: string) => {
if (pathname === path) {
onClose();
return;
}
window.dispatchEvent(new Event("navigationStart"));
router.push(path);
onClose();
// On attend que la page soit chargée
await new Promise((resolve) => setTimeout(resolve, 300));
window.dispatchEvent(new Event("navigationComplete"));
},
[pathname, router, onClose]
);