Update src/app/page.tsx
This commit is contained in:
@@ -11,25 +11,25 @@ import ContactSplitForm from '@/components/sections/contact/ContactSplitForm';
|
||||
import FaqSplitText from '@/components/sections/faq/FaqSplitText';
|
||||
import FooterBaseCard from '@/components/sections/footer/FooterBaseCard';
|
||||
import { Award, Shield } from 'lucide-react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useEffect, useState, useRef } from 'react';
|
||||
|
||||
export default function LandingPage() {
|
||||
const [isScrolled, setIsScrolled] = useState(false);
|
||||
const [heroHeight, setHeroHeight] = useState(0);
|
||||
const heroHeightRef = useRef(0);
|
||||
|
||||
useEffect(() => {
|
||||
const handleScroll = () => {
|
||||
setIsScrolled(window.scrollY > heroHeight);
|
||||
};
|
||||
|
||||
const heroElement = document.getElementById('hero');
|
||||
if (heroElement) {
|
||||
setHeroHeight(heroElement.offsetHeight);
|
||||
heroHeightRef.current = heroElement.offsetHeight;
|
||||
}
|
||||
|
||||
const handleScroll = () => {
|
||||
setIsScrolled(window.scrollY > heroHeightRef.current);
|
||||
};
|
||||
|
||||
window.addEventListener('scroll', handleScroll);
|
||||
return () => window.removeEventListener('scroll', handleScroll);
|
||||
}, [heroHeight]);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<ThemeProvider
|
||||
|
||||
Reference in New Issue
Block a user