From 9a96bb4212f5f12ce54bd2400c75bd9671d1fe62 Mon Sep 17 00:00:00 2001 From: KishiTheMechanic Date: Thu, 17 Oct 2024 03:17:14 +0200 Subject: [PATCH] always show header when user on top --- src/app/[locale]/layout.tsx | 6 +++++- src/components/config/ModeToggle.tsx | 3 --- src/hooks/utils/useShowHeader.tsx | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app/[locale]/layout.tsx b/src/app/[locale]/layout.tsx index 29e9ee4..90d8873 100644 --- a/src/app/[locale]/layout.tsx +++ b/src/app/[locale]/layout.tsx @@ -44,7 +44,11 @@ export default async function LocaleLayout({ className={cn(`${inter.variable} ${notoSansJP.variable}`)} suppressHydrationWarning > - + {children} diff --git a/src/components/config/ModeToggle.tsx b/src/components/config/ModeToggle.tsx index 04e018d..ddb4a73 100644 --- a/src/components/config/ModeToggle.tsx +++ b/src/components/config/ModeToggle.tsx @@ -37,9 +37,6 @@ export function ModeToggle() { setTheme('dark')}> {t('common.darkMode')} - setTheme('system')}> - {t('common.systemMode')} - ) diff --git a/src/hooks/utils/useShowHeader.tsx b/src/hooks/utils/useShowHeader.tsx index 5164259..a1b77a6 100644 --- a/src/hooks/utils/useShowHeader.tsx +++ b/src/hooks/utils/useShowHeader.tsx @@ -14,7 +14,7 @@ export function useShowHeader({ defaultShowHeader = true }: Props = {}) { const handleScroll = () => { const currentScrollY = window.scrollY - if (currentScrollY < lastScrollY) { + if (currentScrollY < 80 || currentScrollY < lastScrollY) { setShowHeader(true) } else { setShowHeader(false)