diff --git a/app/components/MobileNav.module.css b/app/components/MobileNav.module.css index e9653b6a6..76ce0dae7 100644 --- a/app/components/MobileNav.module.css +++ b/app/components/MobileNav.module.css @@ -16,9 +16,10 @@ display: flex; justify-content: space-around; align-items: center; - height: 60px; + height: var(--layout-nav-height); background-color: var(--color-bg); border-top: 1.5px solid var(--color-border); + padding: 0 var(--s-4); padding-bottom: env(safe-area-inset-bottom); } @@ -27,17 +28,23 @@ flex-direction: column; align-items: center; justify-content: center; - gap: var(--s-0-5); - padding: var(--s-1) var(--s-2); - min-width: 64px; + padding: 0; + height: 100%; + aspect-ratio: 1 / 1; background: none; border: none; + border-radius: var(--rounded-sm); color: var(--color-text-high); font-size: var(--fonts-xxxs); font-weight: var(--semi-bold); cursor: pointer; text-decoration: none; transition: color 0.15s; + + &:focus-visible { + outline: var(--input-focus-ring); + outline-offset: -1px; + } } .tab:hover, diff --git a/app/components/MobileNav.tsx b/app/components/MobileNav.tsx index 4b8b51502..0717dc6cd 100644 --- a/app/components/MobileNav.tsx +++ b/app/components/MobileNav.tsx @@ -242,7 +242,12 @@ function MenuOverlay({

{t("front:mobileNav.menu")}

- } variant="minimal" onPress={onClose} /> + } + variant="minimal" + shape="circle" + onPress={onClose} + />
diff --git a/app/components/layout/LogInButtonContainer.tsx b/app/components/layout/LogInButtonContainer.tsx index 63a8404b7..3211d1b2e 100644 --- a/app/components/layout/LogInButtonContainer.tsx +++ b/app/components/layout/LogInButtonContainer.tsx @@ -18,11 +18,7 @@ export function LogInButtonContainer({ return ( <> -
+ {children}
{authError != null && diff --git a/app/components/layout/index.module.css b/app/components/layout/index.module.css index a81019ddb..2a748db54 100644 --- a/app/components/layout/index.module.css +++ b/app/components/layout/index.module.css @@ -10,9 +10,7 @@ align-items: center; gap: var(--s-3); border-bottom: 1.5px solid var(--color-border); - -webkit-backdrop-filter: blur(10px) brightness(95%); - backdrop-filter: blur(10px) brightness(95%); - background-color: transparent; + background-color: var(--color-bg); font-weight: bold; padding-inline: var(--s-4); position: sticky; diff --git a/app/components/layout/index.tsx b/app/components/layout/index.tsx index a31a6e061..d1d76948c 100644 --- a/app/components/layout/index.tsx +++ b/app/components/layout/index.tsx @@ -124,6 +124,50 @@ function useSideNavCollapsed(initialCollapsed: boolean) { return [collapsed, setCollapsedAndPersist] as const; } +function useNavOffset() { + const [navOffset, setNavOffset] = React.useState(0); + const lastScrollY = React.useRef(0); + + const MOBILE_BREAKPOINT = 600; + const NAV_HEIGHT = 55; + + React.useEffect(() => { + const handleScroll = () => { + if (window.innerWidth >= MOBILE_BREAKPOINT) { + setNavOffset(0); + lastScrollY.current = window.scrollY; + return; + } + + const currentScrollY = window.scrollY; + const scrollDelta = currentScrollY - lastScrollY.current; + + setNavOffset((prevOffset) => { + const newOffset = prevOffset - scrollDelta; + return Math.max(-NAV_HEIGHT, Math.min(0, newOffset)); + }); + + lastScrollY.current = currentScrollY; + }; + + const handleResize = () => { + if (window.innerWidth >= MOBILE_BREAKPOINT) { + setNavOffset(0); + } + }; + + window.addEventListener("scroll", handleScroll, { passive: true }); + window.addEventListener("resize", handleResize); + + return () => { + window.removeEventListener("scroll", handleScroll); + window.removeEventListener("resize", handleResize); + }; + }, []); + + return navOffset; +} + export function Layout({ children, data, @@ -135,11 +179,12 @@ export function Layout({ const [sideNavCollapsed, setSideNavCollapsed] = useSideNavCollapsed( data?.sidenavCollapsed ?? false, ); - const location = useLocation(); const { t } = useTranslation(["front"]); const { formatRelativeDate } = useTimeFormat(); + const location = useLocation(); const sidebarData = useSidebarData(); + const navOffset = useNavOffset(); const events = sidebarData?.events ?? []; const matchStatus = sidebarData?.matchStatus; @@ -153,6 +198,7 @@ export function Layout({ import.meta.env.VITE_PLAYWIRE_PUBLISHER_ID && !data?.user?.roles.includes("MINOR_SUPPORT") && !location.pathname.includes("plans"); + return ( <> setNavDialogOpen(false)} /> @@ -260,7 +306,12 @@ export function Layout({
-
+
setSideNavCollapsed(!sideNavCollapsed)}