From 44c2c46da850830bd48f8fce11b7086b40effda7 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 1 Mar 2022 01:14:25 -0800 Subject: [PATCH] Add scroll handler --- pages/[username].tsx | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/pages/[username].tsx b/pages/[username].tsx index 3d027042..8af53122 100644 --- a/pages/[username].tsx +++ b/pages/[username].tsx @@ -31,6 +31,11 @@ const ProfileRoute: React.FC = () => { const [raidId, setRaidId] = useState(null) const [recencyInSeconds, setRecencyInSeconds] = useState(null) + useEffect(() => { + window.addEventListener("scroll", handleScroll) + return () => window.removeEventListener("scroll", handleScroll); + }, []) + useEffect(() => { if (username) fetchProfile(username as string) @@ -93,16 +98,6 @@ const ProfileRoute: React.FC = () => { setRecencyInSeconds(null) } - function render() { - const content = (parties && parties.length > 0) ? renderGrids() : renderNoGrids() - return ( -
- - {content} -
- ) - } - function handleScroll() { if (window.pageYOffset > 90) setScrolled(true)