From c009f71e39864ffd146580a0003af9e88f90096a Mon Sep 17 00:00:00 2001 From: MOH Date: Mon, 9 Mar 2026 08:07:47 +0100 Subject: [PATCH] some fixes to heros --- app/[locale]/coming-soon/page.tsx | 2 +- components/layout/home-hero.tsx | 42 ++++++++----- components/layout/page-hero.tsx | 26 ++++---- components/layout/site-hero.tsx | 98 ++++++++++++++++++++++++++++--- 4 files changed, 133 insertions(+), 35 deletions(-) diff --git a/app/[locale]/coming-soon/page.tsx b/app/[locale]/coming-soon/page.tsx index 12d130b..8dfb408 100644 --- a/app/[locale]/coming-soon/page.tsx +++ b/app/[locale]/coming-soon/page.tsx @@ -67,7 +67,7 @@ export default async function ComingSoonPage({ {t("kicker")}

- +

{t("description")} diff --git a/components/layout/home-hero.tsx b/components/layout/home-hero.tsx index 8780ddf..a0d65c2 100644 --- a/components/layout/home-hero.tsx +++ b/components/layout/home-hero.tsx @@ -1,4 +1,10 @@ -import { HeroScrollLink, HeroShell, HeroTitle } from "@/components/layout/site-hero"; +import { + HeroContentMotion, + HeroMotionItem, + HeroScrollLink, + HeroShell, + HeroTitle, +} from "@/components/layout/site-hero"; type HomeHeroProps = { locale: string; @@ -39,20 +45,26 @@ export function HomeHero({ return ( -

- {kicker} -

- -

- {description} -

-
- -
+ + +

+ {kicker} +

+
+ + +

+ {description} +

+
+ + + +
); } diff --git a/components/layout/page-hero.tsx b/components/layout/page-hero.tsx index 54731f1..907371e 100644 --- a/components/layout/page-hero.tsx +++ b/components/layout/page-hero.tsx @@ -1,4 +1,4 @@ -import { HeroShell, HeroTitle } from "@/components/layout/site-hero"; +import { HeroContentMotion, HeroMotionItem, HeroShell, HeroTitle } from "@/components/layout/site-hero"; type PageHeroProps = { title: string; @@ -8,15 +8,21 @@ type PageHeroProps = { export function PageHero({ title, description }: PageHeroProps) { return ( -

- {title} -

- - {description ? ( -

- {description} -

- ) : null} + + +

+ {title} +

+
+ + {description ? ( + +

+ {description} +

+
+ ) : null} +
); } diff --git a/components/layout/site-hero.tsx b/components/layout/site-hero.tsx index a94d457..f2d0942 100644 --- a/components/layout/site-hero.tsx +++ b/components/layout/site-hero.tsx @@ -1,6 +1,9 @@ +"use client"; + import type { ReactNode } from "react"; import { ArrowDown } from "lucide-react"; +import { motion, useReducedMotion } from "framer-motion"; import { Container } from "@/components/layout/container"; import { HeroMotionBackdrop } from "@/components/layout/hero-motion-backdrop"; @@ -39,6 +42,12 @@ type HeroScrollLinkProps = { className?: string; }; +type HeroContentMotionProps = { + children: ReactNode; + className?: string; + variant?: "home" | "page"; +}; + const toneClasses: Record = { default: "", accent: "hero-title-accent", @@ -67,7 +76,7 @@ export function HeroShell({ "hero-surface relative isolate overflow-hidden", variant === "home" ? "hero-home flex min-h-[92svh] items-center justify-center" - : "hero-page flex min-h-[44svh] items-end sm:min-h-[48svh]", + : "hero-page flex min-h-[44svh] items-center sm:min-h-[48svh]", className, )} > @@ -81,7 +90,7 @@ export function HeroShell({ "relative z-10 w-full", variant === "home" ? "pb-12 pt-24 sm:pb-14 sm:pt-28 lg:pb-16 lg:pt-32" - : "pb-10 pt-24 sm:pb-12 sm:pt-28 lg:pb-14 lg:pt-32", + : "py-20 sm:py-24 lg:py-28", containerClassName, )} > @@ -99,6 +108,59 @@ export function HeroShell({ ); } +export function HeroContentMotion({ + children, + className, + variant = "home", +}: HeroContentMotionProps) { + const reducedMotion = useReducedMotion(); + + if (reducedMotion) { + return
{children}
; + } + + return ( + + {children} + + ); +} + +export function HeroMotionItem({ + children, + className, + variant = "home", +}: HeroContentMotionProps) { + const reducedMotion = useReducedMotion(); + + return ( + + {children} + + ); +} + export function HeroTitle({ lines, locale = "en", @@ -106,16 +168,24 @@ export function HeroTitle({ className, }: HeroTitleProps) { const isArabic = locale === "ar"; + const reducedMotion = useReducedMotion(); return ( -

@@ -131,7 +201,7 @@ export function HeroTitle({ {line.text} ))} -

+ ); } @@ -140,9 +210,19 @@ export function HeroScrollLink({ label, className, }: HeroScrollLinkProps) { + const reducedMotion = useReducedMotion(); + return ( - + - + ); }