some fixes to heros
CI / quality (push) Waiting to run

This commit is contained in:
MOH
2026-03-09 08:07:47 +01:00
parent 863dbb0f81
commit c009f71e39
4 changed files with 133 additions and 35 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ export default async function ComingSoonPage({
{t("kicker")} {t("kicker")}
</p> </p>
<HeroTitle locale={localeKey} lines={lines} className="mx-auto mt-8 max-w-[46rem]" /> <HeroTitle locale={localeKey} lines={lines} className="mx-auto mt-8" />
<p className="mx-auto mt-8 max-w-[34rem] text-sm leading-7 text-foreground/68 sm:text-base"> <p className="mx-auto mt-8 max-w-[34rem] text-sm leading-7 text-foreground/68 sm:text-base">
{t("description")} {t("description")}
+27 -15
View File
@@ -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 = { type HomeHeroProps = {
locale: string; locale: string;
@@ -39,20 +45,26 @@ export function HomeHero({
return ( return (
<HeroShell showBridges> <HeroShell showBridges>
<p className="max-w-[34rem] text-sm font-medium tracking-[0.12em] text-foreground/62 sm:text-base"> <HeroContentMotion variant="home">
{kicker} <HeroMotionItem variant="home">
</p> <p className="max-w-[34rem] text-sm font-medium tracking-[0.12em] text-foreground/62 sm:text-base">
<HeroTitle locale={locale} lines={lines} /> {kicker}
<p className="mx-auto mt-7 max-w-[33rem] whitespace-pre-line text-sm leading-7 text-foreground/68 sm:text-base sm:leading-8"> </p>
{description} </HeroMotionItem>
</p> <HeroTitle locale={locale} lines={lines} />
<div className="mt-9 flex items-center justify-center"> <HeroMotionItem variant="home">
<HeroScrollLink <p className="mx-auto mt-7 max-w-[33rem] whitespace-pre-line text-sm leading-7 text-foreground/68 sm:text-base sm:leading-8">
href="#home-content" {description}
label="Scroll to content" </p>
className="text-[hsl(var(--hero-ink)/0.78)] dark:text-foreground/82" </HeroMotionItem>
/> <HeroMotionItem variant="home" className="mt-9 flex items-center justify-center">
</div> <HeroScrollLink
href="#home-content"
label="Scroll to content"
className="text-[hsl(var(--hero-ink)/0.78)] dark:text-foreground/82"
/>
</HeroMotionItem>
</HeroContentMotion>
</HeroShell> </HeroShell>
); );
} }
+16 -10
View File
@@ -1,4 +1,4 @@
import { HeroShell, HeroTitle } from "@/components/layout/site-hero"; import { HeroContentMotion, HeroMotionItem, HeroShell, HeroTitle } from "@/components/layout/site-hero";
type PageHeroProps = { type PageHeroProps = {
title: string; title: string;
@@ -8,15 +8,21 @@ type PageHeroProps = {
export function PageHero({ title, description }: PageHeroProps) { export function PageHero({ title, description }: PageHeroProps) {
return ( return (
<HeroShell compactBackdrop variant="page"> <HeroShell compactBackdrop variant="page">
<p className="text-sm font-medium tracking-[0.12em] text-foreground/56"> <HeroContentMotion variant="page">
{title} <HeroMotionItem variant="page">
</p> <p className="inline-flex items-center rounded-pill border border-border/70 bg-background/75 px-4 py-2 text-sm font-medium tracking-[-0.01em] text-foreground/82 shadow-xs backdrop-blur-chrome">
<HeroTitle lines={[{ text: title }]} variant="page" /> {title}
{description ? ( </p>
<p className="mx-auto mt-5 max-w-[34rem] text-sm leading-7 text-foreground/64 sm:text-base"> </HeroMotionItem>
{description} <HeroTitle lines={[{ text: title }]} variant="page" />
</p> {description ? (
) : null} <HeroMotionItem variant="page">
<p className="mx-auto mt-6 max-w-[34rem] text-base leading-7 text-foreground/72">
{description}
</p>
</HeroMotionItem>
) : null}
</HeroContentMotion>
</HeroShell> </HeroShell>
); );
} }
+89 -9
View File
@@ -1,6 +1,9 @@
"use client";
import type { ReactNode } from "react"; import type { ReactNode } from "react";
import { ArrowDown } from "lucide-react"; import { ArrowDown } from "lucide-react";
import { motion, useReducedMotion } from "framer-motion";
import { Container } from "@/components/layout/container"; import { Container } from "@/components/layout/container";
import { HeroMotionBackdrop } from "@/components/layout/hero-motion-backdrop"; import { HeroMotionBackdrop } from "@/components/layout/hero-motion-backdrop";
@@ -39,6 +42,12 @@ type HeroScrollLinkProps = {
className?: string; className?: string;
}; };
type HeroContentMotionProps = {
children: ReactNode;
className?: string;
variant?: "home" | "page";
};
const toneClasses: Record<HeroTone, string> = { const toneClasses: Record<HeroTone, string> = {
default: "", default: "",
accent: "hero-title-accent", accent: "hero-title-accent",
@@ -67,7 +76,7 @@ export function HeroShell({
"hero-surface relative isolate overflow-hidden", "hero-surface relative isolate overflow-hidden",
variant === "home" variant === "home"
? "hero-home flex min-h-[92svh] items-center justify-center" ? "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, className,
)} )}
> >
@@ -81,7 +90,7 @@ export function HeroShell({
"relative z-10 w-full", "relative z-10 w-full",
variant === "home" variant === "home"
? "pb-12 pt-24 sm:pb-14 sm:pt-28 lg:pb-16 lg:pt-32" ? "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, containerClassName,
)} )}
> >
@@ -99,6 +108,59 @@ export function HeroShell({
); );
} }
export function HeroContentMotion({
children,
className,
variant = "home",
}: HeroContentMotionProps) {
const reducedMotion = useReducedMotion();
if (reducedMotion) {
return <div className={className}>{children}</div>;
}
return (
<motion.div
initial="hidden"
animate="visible"
variants={{
hidden: {},
visible: {
transition: {
staggerChildren: variant === "home" ? 0.07 : 0.05,
delayChildren: variant === "home" ? 0.08 : 0.04,
},
},
}}
className={className}
>
{children}
</motion.div>
);
}
export function HeroMotionItem({
children,
className,
variant = "home",
}: HeroContentMotionProps) {
const reducedMotion = useReducedMotion();
return (
<motion.div
initial={reducedMotion ? false : { opacity: 0, y: variant === "home" ? 14 : 10, filter: "blur(6px)" }}
animate={reducedMotion ? undefined : { opacity: 1, y: 0, filter: "blur(0px)" }}
transition={{
duration: variant === "home" ? 0.48 : 0.38,
ease: [0.22, 1, 0.36, 1],
}}
className={className}
>
{children}
</motion.div>
);
}
export function HeroTitle({ export function HeroTitle({
lines, lines,
locale = "en", locale = "en",
@@ -106,16 +168,24 @@ export function HeroTitle({
className, className,
}: HeroTitleProps) { }: HeroTitleProps) {
const isArabic = locale === "ar"; const isArabic = locale === "ar";
const reducedMotion = useReducedMotion();
return ( return (
<h1 <motion.h1
initial={reducedMotion ? false : { opacity: 0, y: variant === "home" ? 18 : 12, filter: "blur(8px)" }}
animate={reducedMotion ? undefined : { opacity: 1, y: 0, filter: "blur(0px)" }}
transition={{
duration: variant === "home" ? 0.56 : 0.42,
delay: variant === "home" ? 0.06 : 0.04,
ease: [0.22, 1, 0.36, 1],
}}
className={cn( className={cn(
"text-balance font-semibold text-[hsl(var(--hero-ink))]", "text-balance font-semibold text-[hsl(var(--hero-ink))]",
variant === "home" variant === "home"
? isArabic ? isArabic
? "mt-6 flex w-full max-w-[42rem] flex-col gap-y-1 text-[clamp(3rem,11vw,5.9rem)] leading-[1.06] tracking-[-0.03em] sm:max-w-[48rem]" ? "mt-6 flex w-full max-w-[16rem] flex-col gap-y-1 text-[clamp(3rem,11vw,5.9rem)] leading-[1.06] tracking-[-0.03em] md:max-w-[22rem] lg:max-w-[32rem]"
: "mt-6 flex w-full max-w-[40rem] flex-col gap-y-1 text-[clamp(3.1rem,11vw,6.3rem)] leading-[0.94] tracking-[-0.06em] sm:max-w-[46rem]" : "mt-6 flex w-full max-w-[16rem] flex-col gap-y-1 text-[clamp(3.1rem,11vw,6.3rem)] leading-[0.94] tracking-[-0.06em] md:max-w-[22rem] lg:max-w-[32rem]"
: "mt-4 flex w-full max-w-[34rem] flex-col gap-y-1 text-[clamp(2.8rem,10vw,4.9rem)] leading-[0.96] tracking-[-0.06em] sm:max-w-[40rem]", : "mt-4 flex w-full max-w-[16rem] flex-col gap-y-1 text-[clamp(2.8rem,10vw,4.9rem)] leading-[0.96] tracking-[-0.06em] md:max-w-[22rem] lg:max-w-[32rem]",
className, className,
)} )}
> >
@@ -131,7 +201,7 @@ export function HeroTitle({
{line.text} {line.text}
</span> </span>
))} ))}
</h1> </motion.h1>
); );
} }
@@ -140,9 +210,19 @@ export function HeroScrollLink({
label, label,
className, className,
}: HeroScrollLinkProps) { }: HeroScrollLinkProps) {
const reducedMotion = useReducedMotion();
return ( return (
<a href={href} aria-label={label} className={cn("hero-scroll-link", className)}> <motion.a
href={href}
aria-label={label}
initial={reducedMotion ? false : { opacity: 0, y: 10 }}
animate={reducedMotion ? undefined : { opacity: 1, y: 0 }}
transition={{ duration: 0.34, delay: 0.16, ease: [0.22, 1, 0.36, 1] }}
whileHover={reducedMotion ? undefined : { y: 2 }}
className={cn("hero-scroll-link", className)}
>
<ArrowDown className="h-5 w-5" /> <ArrowDown className="h-5 w-5" />
</a> </motion.a>
); );
} }