fix: add SSR-safe ScrollFadeIn component for scroll animations
ScrollFadeIn uses IntersectionObserver + CSS transitions instead of Framer Motion's initial prop. Key difference: no inline style in SSR HTML, so content is visible by default. Animation only activates after client hydration (hasMounted check). Wraps About, Projects, Contact, Footer in HomePageServer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import Header from "../components/Header.server";
|
||||
import Hero from "../components/Hero";
|
||||
import ScrollFadeIn from "../components/ScrollFadeIn";
|
||||
import Script from "next/script";
|
||||
import {
|
||||
getAboutTranslations,
|
||||
@@ -78,7 +79,9 @@ export default async function HomePageServer({ locale }: HomePageServerProps) {
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<AboutClient locale={locale} translations={aboutT} />
|
||||
<ScrollFadeIn>
|
||||
<AboutClient locale={locale} translations={aboutT} />
|
||||
</ScrollFadeIn>
|
||||
|
||||
{/* Wavy Separator 2 - About to Projects */}
|
||||
<div className="relative h-24 overflow-hidden">
|
||||
@@ -101,7 +104,9 @@ export default async function HomePageServer({ locale }: HomePageServerProps) {
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<ProjectsClient locale={locale} translations={projectsT} />
|
||||
<ScrollFadeIn>
|
||||
<ProjectsClient locale={locale} translations={projectsT} />
|
||||
</ScrollFadeIn>
|
||||
|
||||
{/* Wavy Separator 3 - Projects to Contact */}
|
||||
<div className="relative h-24 overflow-hidden">
|
||||
@@ -124,9 +129,13 @@ export default async function HomePageServer({ locale }: HomePageServerProps) {
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<ContactClient locale={locale} translations={contactT} />
|
||||
<ScrollFadeIn>
|
||||
<ContactClient locale={locale} translations={contactT} />
|
||||
</ScrollFadeIn>
|
||||
</main>
|
||||
<FooterClient locale={locale} translations={footerT} />
|
||||
<ScrollFadeIn>
|
||||
<FooterClient locale={locale} translations={footerT} />
|
||||
</ScrollFadeIn>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user