From 834d70d7747148d08b3c19720aca8d56b3d0de68 Mon Sep 17 00:00:00 2001 From: Stixx Date: Mon, 2 Dec 2024 15:01:29 +0100 Subject: [PATCH] fix: better UX when clicking on logo when on home screen or `home` button in footer --- src/components/AppBar/AppBar.tsx | 12 +++++++++++- src/components/Footer/Footer.tsx | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/AppBar/AppBar.tsx b/src/components/AppBar/AppBar.tsx index 6a5862d..a4f653e 100644 --- a/src/components/AppBar/AppBar.tsx +++ b/src/components/AppBar/AppBar.tsx @@ -121,7 +121,17 @@ export const AppBar = () => { - Logo navigate('/')} /> + Logo { + if (window.location.pathname === '/') { + location.reload() + } else { + navigate('/') + } + }} + /> diff --git a/src/components/Footer/Footer.tsx b/src/components/Footer/Footer.tsx index ead7cec..249b8c4 100644 --- a/src/components/Footer/Footer.tsx +++ b/src/components/Footer/Footer.tsx @@ -68,6 +68,12 @@ export const Footer = () => }} component={Link} to={'/'} + onClick={(event) => { + if (window.location.pathname === '/') { + event.preventDefault() + window.scrollTo(0, 0) + } + }} variant={'text'} > Home