Skip to content

Commit 6c0a88d

Browse files
committed
Ensures proper page rendering and scrolling by cleaning up Lenis styles, enabling Join page content scroll, and refactoring Header visibility logic.
1 parent b8887b9 commit 6c0a88d

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

client/src/components/Header.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ export default function Header() {
99
// Hook from react-router-dom to get the current URL path
1010
const location = useLocation();
1111

12-
// Hide header on full-screen pages that have their own navigation
13-
const isApplyPage = location.pathname === '/join' || location.pathname === '/apply';
14-
if (isApplyPage) return null;
15-
1612
// Effect to add a scroll listener when the component mounts
1713
useEffect(() => {
1814
const handleScroll = () => {
@@ -25,6 +21,11 @@ export default function Header() {
2521
return () => window.removeEventListener('scroll', handleScroll);
2622
}, []);
2723

24+
// Hide header on full-screen pages that have their own navigation
25+
// IMPORTANT: This must be AFTER all hooks to comply with React's rules of hooks
26+
const isApplyPage = location.pathname === '/join' || location.pathname === '/apply';
27+
if (isApplyPage) return null;
28+
2829
// Function to handle navigation clicks, primarily for closing the mobile menu
2930
const handleNavClick = () => {
3031
setIsMenuOpen(false);

client/src/pages/HomePage.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ export default function HomePage() {
2222
return () => {
2323
cancelAnimationFrame(rafId);
2424
lenis.destroy();
25+
// Lenis sets overflow:hidden on html/body and uses CSS transforms for scrolling.
26+
// Its destroy() doesn't always restore these during React's async cleanup,
27+
// causing the next page to render "blank" (content hidden by overflow:hidden).
28+
document.documentElement.style.overflow = '';
29+
document.body.style.overflow = '';
30+
window.scrollTo(0, 0);
2531
};
2632
}, []);
2733

client/src/pages/JoinPage.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function JoinUs() {
1717
return (
1818
// FIX: Changed from 'fixed' to 'absolute' to ensure natural scrolling
1919
// Added 'min-h-screen' and 'bg-black' to cover everything
20-
<div className="absolute inset-0 z-[100] w-full min-h-screen bg-black text-white flex flex-col">
20+
<div className="fixed inset-0 z-[100] w-full min-h-screen bg-black text-white flex flex-col overflow-y-auto">
2121

2222
{/* Background Texture - Fixed Position so it stays while scrolling */}
2323
<div className="fixed inset-0 opacity-[0.03] pointer-events-none"

0 commit comments

Comments
 (0)