From fbd46cb6abdecc59d31d7ed0e7b7782f65cd0679 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Thu, 20 Feb 2025 00:07:26 +0100 Subject: [PATCH] perf(topbar): optimize scroll up/down animation with GPU acceleration --- src/components/sticky-header/sticky-header.module.css | 4 +++- src/components/sticky-header/sticky-header.tsx | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/sticky-header/sticky-header.module.css b/src/components/sticky-header/sticky-header.module.css index 76bc34bb..08c9a03b 100644 --- a/src/components/sticky-header/sticky-header.module.css +++ b/src/components/sticky-header/sticky-header.module.css @@ -4,7 +4,9 @@ position: fixed; width: 100%; z-index: 6; - transition: top 0.2s ease-in-out; + will-change: transform; + transform: translateY(0); + transition: transform 0.2s ease-in-out; align-items: center; justify-content: space-around; } diff --git a/src/components/sticky-header/sticky-header.tsx b/src/components/sticky-header/sticky-header.tsx index 08750aae..0e21e888 100644 --- a/src/components/sticky-header/sticky-header.tsx +++ b/src/components/sticky-header/sticky-header.tsx @@ -24,7 +24,7 @@ const StickyHeader = () => { }, []); return ( -
+