Refactor shared hero structure

This commit is contained in:
MOH
2026-03-09 07:14:11 +01:00
parent 9d76eabb39
commit 8f87169da1
6 changed files with 242 additions and 130 deletions
+22 -25
View File
@@ -5,6 +5,7 @@ import { getTranslations } from "next-intl/server";
import { Container } from "@/components/layout/container";
import { MotionFade } from "@/components/motion-fade";
import { HeroShell, HeroTitle } from "@/components/layout/site-hero";
import { buildLocalizedMetadata } from "@/lib/metadata";
import { getLocalizedPath, resolveLocale } from "@/lib/locale";
import { AppCard } from "@/components/ui/app-card";
@@ -37,32 +38,28 @@ export default async function SuccessPage({ params: { locale } }: SuccessPagePro
return (
<>
<section className="hero-surface hero-page relative isolate overflow-hidden pb-12 pt-24 sm:pt-28 lg:pb-16 lg:pt-32">
<Container size="narrow" className="text-center">
<MotionFade className="w-full">
<div className="mx-auto flex max-w-[42rem] flex-col items-center">
<CheckCircle2 className="h-14 w-14 text-status-success" />
<p className="mt-5 text-sm font-medium tracking-[-0.02em] text-foreground/58">
{t("title")}
</p>
<h1 className="mt-4 text-balance text-4xl font-semibold leading-[0.9] tracking-[-0.07em] text-foreground sm:text-5xl lg:text-[4.5rem]">
{t("title")}
</h1>
<p className="mx-auto mt-5 max-w-[32rem] text-sm leading-6 text-foreground/64 sm:text-base">
{t("text")}
</p>
<div className="mt-8 flex flex-wrap items-center justify-center gap-3">
<Button asChild>
<Link href={getLocalizedPath(localeKey)}>{t("home")}</Link>
</Button>
<Button asChild variant="outline">
<Link href={getLocalizedPath(localeKey, "/contact")}>{t("contact")}</Link>
</Button>
</div>
<HeroShell compactBackdrop size="narrow" variant="page">
<MotionFade className="w-full">
<div className="mx-auto flex max-w-[42rem] flex-col items-center">
<CheckCircle2 className="h-14 w-14 text-status-success" />
<p className="mt-5 text-sm font-medium tracking-[0.12em] text-foreground/56">
{t("title")}
</p>
<HeroTitle lines={[{ text: t("title") }]} variant="page" />
<p className="mx-auto mt-5 max-w-[32rem] text-sm leading-7 text-foreground/64 sm:text-base">
{t("text")}
</p>
<div className="mt-8 flex flex-wrap items-center justify-center gap-3">
<Button asChild>
<Link href={getLocalizedPath(localeKey)}>{t("home")}</Link>
</Button>
<Button asChild variant="outline">
<Link href={getLocalizedPath(localeKey, "/contact")}>{t("contact")}</Link>
</Button>
</div>
</MotionFade>
</Container>
</section>
</div>
</MotionFade>
</HeroShell>
<Container size="narrow" className="pb-12 lg:pb-16">
<MotionFade className="w-full" delay={0.06}>
+22 -37
View File
@@ -3,8 +3,8 @@ import { Sparkles } from "lucide-react";
import { getTranslations } from "next-intl/server";
import { FloatingPreferences } from "@/components/layout/floating-preferences";
import { HeroMotionBackdrop } from "@/components/layout/hero-motion-backdrop";
import { MotionFade } from "@/components/motion-fade";
import { HeroShell, HeroTitle } from "@/components/layout/site-hero";
import { getSiteSettings } from "@/lib/app-config";
import { buildLocalizedMetadata } from "@/lib/metadata";
import { resolveLocale } from "@/lib/locale";
@@ -37,52 +37,37 @@ export default async function ComingSoonPage({
const localeKey = resolveLocale(locale);
const t = await getTranslations({ locale: localeKey, namespace: "comingSoon" });
const isArabic = localeKey === "ar";
const lines = [
{
text: t("titleLineOne"),
tone: "soft" as const,
align: isArabic ? "center" as const : "start" as const,
},
{
text: t("titleLineTwo"),
tone: "default" as const,
align: isArabic ? "center" as const : "end" as const,
},
{
text: t("titleLineThree"),
tone: "accent" as const,
align: isArabic ? "center" as const : "start" as const,
},
];
return (
<div className="relative min-h-screen overflow-hidden">
<FloatingPreferences locale={localeKey} />
<section className="hero-surface hero-home relative isolate flex min-h-screen items-center justify-center overflow-hidden px-4 pb-10 pt-24 sm:px-6 sm:pt-28 lg:px-8">
<HeroMotionBackdrop />
<div className="hero-header-bridge" />
<div className="hero-content-bridge" />
<HeroShell className="min-h-screen" showBridges>
<MotionFade className="relative z-10 w-full">
<div className="mx-auto max-w-[56rem] text-center">
<p className="inline-flex items-center gap-2 rounded-full border border-black/6 bg-white/24 px-4 py-2 text-sm font-medium tracking-[-0.02em] text-[hsl(var(--hero-ink)/0.84)] shadow-[0_14px_34px_-24px_rgba(15,23,42,0.18)] backdrop-blur-[18px] dark:border-white/10 dark:bg-white/4 dark:text-foreground/84 dark:shadow-[0_20px_48px_-28px_rgba(0,0,0,0.58)]">
<p className="inline-flex items-center gap-2 rounded-pill border border-foreground/8 bg-background/55 px-4 py-2 text-sm font-medium tracking-[0.08em] text-[hsl(var(--hero-ink)/0.84)] shadow-[var(--shadow-sm)] backdrop-blur-[18px] dark:border-foreground/10 dark:bg-background/20 dark:text-foreground/84">
<Sparkles className="h-3.5 w-3.5 text-brand-secondary" />
{t("kicker")}
</p>
<h1
className={
isArabic
? "mx-auto mt-8 flex max-w-[40rem] flex-col items-center gap-y-2 overflow-visible pb-[0.12em] text-[3.35rem] font-bold leading-[1.12] tracking-normal text-[hsl(var(--hero-ink))] drop-shadow-[0_18px_40px_rgba(15,23,42,0.18)] sm:text-[4.7rem] lg:max-w-[44rem] lg:text-[5.5rem]"
: "mx-auto mt-8 flex max-w-[44rem] flex-col gap-y-0.5 overflow-visible pb-[0.2em] text-[3.15rem] font-semibold leading-[0.98] tracking-[-0.05em] text-[hsl(var(--hero-ink))] drop-shadow-[0_18px_40px_rgba(15,23,42,0.22)] sm:text-[4.8rem] lg:max-w-[46rem] lg:gap-y-1 lg:pb-[0.22em] lg:text-[5.85rem]"
}
>
<span
className={
isArabic
? "hero-title-line hero-title-accent-soft self-center whitespace-nowrap"
: "hero-title-line hero-title-accent-soft self-start whitespace-nowrap"
}
>
{t("titleLineOne")}
</span>
<span className={isArabic ? "hero-title-line self-center whitespace-nowrap" : "hero-title-line self-end whitespace-nowrap"}>
{t("titleLineTwo")}
</span>
<span
className={
isArabic
? "hero-title-line hero-title-accent self-center whitespace-nowrap"
: "hero-title-line hero-title-accent self-start whitespace-nowrap"
}
>
{t("titleLineThree")}
</span>
</h1>
<HeroTitle locale={localeKey} lines={lines} className="mx-auto mt-8 max-w-[46rem]" />
<p className="mx-auto mt-8 max-w-[34rem] text-sm leading-7 text-foreground/68 sm:text-base">
{t("description")}
@@ -93,7 +78,7 @@ export default async function ComingSoonPage({
</p>
</div>
</MotionFade>
</section>
</HeroShell>
</div>
);
}