Refactor shared hero structure
This commit is contained in:
@@ -5,6 +5,7 @@ import { getTranslations } from "next-intl/server";
|
|||||||
|
|
||||||
import { Container } from "@/components/layout/container";
|
import { Container } from "@/components/layout/container";
|
||||||
import { MotionFade } from "@/components/motion-fade";
|
import { MotionFade } from "@/components/motion-fade";
|
||||||
|
import { HeroShell, HeroTitle } from "@/components/layout/site-hero";
|
||||||
import { buildLocalizedMetadata } from "@/lib/metadata";
|
import { buildLocalizedMetadata } from "@/lib/metadata";
|
||||||
import { getLocalizedPath, resolveLocale } from "@/lib/locale";
|
import { getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||||
import { AppCard } from "@/components/ui/app-card";
|
import { AppCard } from "@/components/ui/app-card";
|
||||||
@@ -37,32 +38,28 @@ export default async function SuccessPage({ params: { locale } }: SuccessPagePro
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<section className="hero-surface hero-page relative isolate overflow-hidden pb-12 pt-24 sm:pt-28 lg:pb-16 lg:pt-32">
|
<HeroShell compactBackdrop size="narrow" variant="page">
|
||||||
<Container size="narrow" className="text-center">
|
<MotionFade className="w-full">
|
||||||
<MotionFade className="w-full">
|
<div className="mx-auto flex max-w-[42rem] flex-col items-center">
|
||||||
<div className="mx-auto flex max-w-[42rem] flex-col items-center">
|
<CheckCircle2 className="h-14 w-14 text-status-success" />
|
||||||
<CheckCircle2 className="h-14 w-14 text-status-success" />
|
<p className="mt-5 text-sm font-medium tracking-[0.12em] text-foreground/56">
|
||||||
<p className="mt-5 text-sm font-medium tracking-[-0.02em] text-foreground/58">
|
{t("title")}
|
||||||
{t("title")}
|
</p>
|
||||||
</p>
|
<HeroTitle lines={[{ text: t("title") }]} variant="page" />
|
||||||
<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]">
|
<p className="mx-auto mt-5 max-w-[32rem] text-sm leading-7 text-foreground/64 sm:text-base">
|
||||||
{t("title")}
|
{t("text")}
|
||||||
</h1>
|
</p>
|
||||||
<p className="mx-auto mt-5 max-w-[32rem] text-sm leading-6 text-foreground/64 sm:text-base">
|
<div className="mt-8 flex flex-wrap items-center justify-center gap-3">
|
||||||
{t("text")}
|
<Button asChild>
|
||||||
</p>
|
<Link href={getLocalizedPath(localeKey)}>{t("home")}</Link>
|
||||||
<div className="mt-8 flex flex-wrap items-center justify-center gap-3">
|
</Button>
|
||||||
<Button asChild>
|
<Button asChild variant="outline">
|
||||||
<Link href={getLocalizedPath(localeKey)}>{t("home")}</Link>
|
<Link href={getLocalizedPath(localeKey, "/contact")}>{t("contact")}</Link>
|
||||||
</Button>
|
</Button>
|
||||||
<Button asChild variant="outline">
|
|
||||||
<Link href={getLocalizedPath(localeKey, "/contact")}>{t("contact")}</Link>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</MotionFade>
|
</div>
|
||||||
</Container>
|
</MotionFade>
|
||||||
</section>
|
</HeroShell>
|
||||||
|
|
||||||
<Container size="narrow" className="pb-12 lg:pb-16">
|
<Container size="narrow" className="pb-12 lg:pb-16">
|
||||||
<MotionFade className="w-full" delay={0.06}>
|
<MotionFade className="w-full" delay={0.06}>
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import { Sparkles } from "lucide-react";
|
|||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
import { FloatingPreferences } from "@/components/layout/floating-preferences";
|
import { FloatingPreferences } from "@/components/layout/floating-preferences";
|
||||||
import { HeroMotionBackdrop } from "@/components/layout/hero-motion-backdrop";
|
|
||||||
import { MotionFade } from "@/components/motion-fade";
|
import { MotionFade } from "@/components/motion-fade";
|
||||||
|
import { HeroShell, HeroTitle } from "@/components/layout/site-hero";
|
||||||
import { getSiteSettings } from "@/lib/app-config";
|
import { getSiteSettings } from "@/lib/app-config";
|
||||||
import { buildLocalizedMetadata } from "@/lib/metadata";
|
import { buildLocalizedMetadata } from "@/lib/metadata";
|
||||||
import { resolveLocale } from "@/lib/locale";
|
import { resolveLocale } from "@/lib/locale";
|
||||||
@@ -37,52 +37,37 @@ export default async function ComingSoonPage({
|
|||||||
const localeKey = resolveLocale(locale);
|
const localeKey = resolveLocale(locale);
|
||||||
const t = await getTranslations({ locale: localeKey, namespace: "comingSoon" });
|
const t = await getTranslations({ locale: localeKey, namespace: "comingSoon" });
|
||||||
const isArabic = localeKey === "ar";
|
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 (
|
return (
|
||||||
<div className="relative min-h-screen overflow-hidden">
|
<div className="relative min-h-screen overflow-hidden">
|
||||||
<FloatingPreferences locale={localeKey} />
|
<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">
|
<HeroShell className="min-h-screen" showBridges>
|
||||||
<HeroMotionBackdrop />
|
|
||||||
<div className="hero-header-bridge" />
|
|
||||||
<div className="hero-content-bridge" />
|
|
||||||
|
|
||||||
<MotionFade className="relative z-10 w-full">
|
<MotionFade className="relative z-10 w-full">
|
||||||
<div className="mx-auto max-w-[56rem] text-center">
|
<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" />
|
<Sparkles className="h-3.5 w-3.5 text-brand-secondary" />
|
||||||
{t("kicker")}
|
{t("kicker")}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h1
|
<HeroTitle locale={localeKey} lines={lines} className="mx-auto mt-8 max-w-[46rem]" />
|
||||||
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>
|
|
||||||
|
|
||||||
<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")}
|
||||||
@@ -93,7 +78,7 @@ export default async function ComingSoonPage({
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</MotionFade>
|
</MotionFade>
|
||||||
</section>
|
</HeroShell>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export function HeroMotionBackdrop({ compact = false }: HeroMotionBackdropProps)
|
|||||||
scale: compact ? [1, 0.98, 1.04, 1] : [1, 0.94, 1.08, 1],
|
scale: compact ? [1, 0.98, 1.04, 1] : [1, 0.94, 1.08, 1],
|
||||||
}}
|
}}
|
||||||
transition={{
|
transition={{
|
||||||
duration: compact ? 20 : 30,
|
duration: compact ? 20 : 28,
|
||||||
repeat: Number.POSITIVE_INFINITY,
|
repeat: Number.POSITIVE_INFINITY,
|
||||||
ease: "easeInOut",
|
ease: "easeInOut",
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import { ArrowDown } from "lucide-react";
|
import { HeroScrollLink, HeroShell, HeroTitle } from "@/components/layout/site-hero";
|
||||||
|
|
||||||
import { HeroMotionBackdrop } from "@/components/layout/hero-motion-backdrop";
|
|
||||||
|
|
||||||
type HomeHeroProps = {
|
type HomeHeroProps = {
|
||||||
locale: string;
|
locale: string;
|
||||||
@@ -17,53 +15,44 @@ export function HomeHero({
|
|||||||
}: HomeHeroProps) {
|
}: HomeHeroProps) {
|
||||||
const titleLines = title.split("\n").filter(Boolean);
|
const titleLines = title.split("\n").filter(Boolean);
|
||||||
const isArabic = locale === "ar";
|
const isArabic = locale === "ar";
|
||||||
|
const lines = titleLines.map((line, index) => ({
|
||||||
|
text: line,
|
||||||
|
tone: isArabic
|
||||||
|
? index === 0
|
||||||
|
? "accent"
|
||||||
|
: "default"
|
||||||
|
: index === titleLines.length - 1
|
||||||
|
? "accent"
|
||||||
|
: index === 0
|
||||||
|
? "soft"
|
||||||
|
: "default",
|
||||||
|
align: isArabic
|
||||||
|
? "center"
|
||||||
|
: index === 1
|
||||||
|
? "end"
|
||||||
|
: "start",
|
||||||
|
})) as {
|
||||||
|
text: string;
|
||||||
|
tone: "default" | "accent" | "soft";
|
||||||
|
align: "start" | "center" | "end";
|
||||||
|
}[];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="hero-surface hero-home relative isolate flex min-h-[88vh] items-center justify-center overflow-hidden">
|
<HeroShell showBridges>
|
||||||
<HeroMotionBackdrop />
|
<p className="max-w-[34rem] text-sm font-medium tracking-[0.12em] text-foreground/62 sm:text-base">
|
||||||
<div className="hero-header-bridge" />
|
{kicker}
|
||||||
<div className="hero-content-bridge" />
|
</p>
|
||||||
<div className="relative z-10 mx-auto flex w-full max-w-[72rem] flex-col items-center justify-center px-4 pb-12 pt-24 text-center sm:px-6 lg:px-8 lg:pb-16 lg:pt-28">
|
<HeroTitle locale={locale} lines={lines} />
|
||||||
<div className="mx-auto flex max-w-[46rem] flex-col items-center overflow-visible">
|
<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 className="text-base font-medium tracking-[-0.03em] text-[hsl(var(--hero-ink)/0.76)] drop-shadow-[0_10px_24px_rgba(15,23,42,0.16)] sm:text-lg">
|
{description}
|
||||||
{kicker}
|
</p>
|
||||||
</p>
|
<div className="mt-9 flex items-center justify-center">
|
||||||
<h1
|
<HeroScrollLink
|
||||||
className={
|
href="#home-content"
|
||||||
isArabic
|
label="Scroll to content"
|
||||||
? "mt-5 flex w-full max-w-[40rem] flex-col overflow-visible pb-[0.1em] text-[3rem] font-bold leading-[1.1] tracking-normal text-[hsl(var(--hero-ink))] drop-shadow-[0_18px_40px_rgba(15,23,42,0.16)] sm:text-[4.25rem] lg:max-w-[48rem] lg:text-[5.35rem]"
|
className="text-[hsl(var(--hero-ink)/0.78)] dark:text-foreground/82"
|
||||||
: "mt-4 flex w-full max-w-[37rem] flex-col gap-y-0.5 overflow-visible pb-[0.18em] text-[3.25rem] 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:max-w-[39rem] sm:text-[4.9rem] lg:max-w-[40rem] lg:gap-y-1 lg:pb-[0.2em] lg:text-[6rem]"
|
/>
|
||||||
}
|
|
||||||
>
|
|
||||||
{titleLines.map((line, index) => (
|
|
||||||
<span
|
|
||||||
key={`${locale}-${index}-${line}`}
|
|
||||||
className={
|
|
||||||
isArabic
|
|
||||||
? index === 1
|
|
||||||
? "hero-title-line self-center whitespace-nowrap"
|
|
||||||
: "hero-title-line hero-title-accent self-center whitespace-nowrap"
|
|
||||||
: index === 1
|
|
||||||
? "hero-title-line self-end whitespace-nowrap"
|
|
||||||
: index === titleLines.length - 1
|
|
||||||
? "hero-title-line hero-title-accent self-start whitespace-nowrap"
|
|
||||||
: "hero-title-line hero-title-accent-soft self-start whitespace-nowrap"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{line}
|
|
||||||
</span>
|
|
||||||
))}
|
|
||||||
</h1>
|
|
||||||
<p className="mx-auto mt-8 max-w-[30rem] whitespace-pre-line text-sm leading-7 text-[hsl(var(--hero-ink)/0.72)] drop-shadow-[0_8px_18px_rgba(15,23,42,0.12)] sm:text-base">
|
|
||||||
{description}
|
|
||||||
</p>
|
|
||||||
<div className="mt-10 flex items-center justify-center">
|
|
||||||
<a href="#home-content" aria-label="Scroll to content" className="hero-scroll-link text-[hsl(var(--hero-ink)/0.74)] dark:text-foreground/82">
|
|
||||||
<ArrowDown className="h-5 w-5" />
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</HeroShell>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { HeroMotionBackdrop } from "@/components/layout/hero-motion-backdrop";
|
import { HeroShell, HeroTitle } from "@/components/layout/site-hero";
|
||||||
|
|
||||||
type PageHeroProps = {
|
type PageHeroProps = {
|
||||||
title: string;
|
title: string;
|
||||||
@@ -7,23 +7,16 @@ type PageHeroProps = {
|
|||||||
|
|
||||||
export function PageHero({ title, description }: PageHeroProps) {
|
export function PageHero({ title, description }: PageHeroProps) {
|
||||||
return (
|
return (
|
||||||
<section className="hero-surface hero-page relative isolate flex min-h-[42vh] items-end overflow-hidden">
|
<HeroShell compactBackdrop variant="page">
|
||||||
<HeroMotionBackdrop compact />
|
<p className="text-sm font-medium tracking-[0.12em] text-foreground/56">
|
||||||
<div className="relative z-10 mx-auto w-full max-w-[72rem] px-4 pb-10 pt-24 sm:px-6 lg:px-8 lg:pb-12 lg:pt-28">
|
{title}
|
||||||
<div className="mx-auto max-w-[42rem] text-center">
|
</p>
|
||||||
<p className="text-sm font-medium tracking-[-0.02em] text-foreground/58">
|
<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">
|
||||||
<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]">
|
{description}
|
||||||
{title}
|
</p>
|
||||||
</h1>
|
) : null}
|
||||||
{description ? (
|
</HeroShell>
|
||||||
<p className="mx-auto mt-5 max-w-[32rem] text-sm leading-6 text-foreground/64 sm:text-base">
|
|
||||||
{description}
|
|
||||||
</p>
|
|
||||||
) : null}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,148 @@
|
|||||||
|
import type { ReactNode } from "react";
|
||||||
|
|
||||||
|
import { ArrowDown } from "lucide-react";
|
||||||
|
|
||||||
|
import { Container } from "@/components/layout/container";
|
||||||
|
import { HeroMotionBackdrop } from "@/components/layout/hero-motion-backdrop";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
type HeroTone = "default" | "accent" | "soft";
|
||||||
|
type HeroLineAlign = "start" | "center" | "end";
|
||||||
|
|
||||||
|
type HeroTitleLine = {
|
||||||
|
text: string;
|
||||||
|
tone?: HeroTone;
|
||||||
|
align?: HeroLineAlign;
|
||||||
|
};
|
||||||
|
|
||||||
|
type HeroShellProps = {
|
||||||
|
children: ReactNode;
|
||||||
|
className?: string;
|
||||||
|
compactBackdrop?: boolean;
|
||||||
|
containerClassName?: string;
|
||||||
|
contentClassName?: string;
|
||||||
|
showBridges?: boolean;
|
||||||
|
size?: "default" | "narrow" | "wide";
|
||||||
|
variant?: "home" | "page";
|
||||||
|
};
|
||||||
|
|
||||||
|
type HeroTitleProps = {
|
||||||
|
lines: HeroTitleLine[];
|
||||||
|
locale?: string;
|
||||||
|
variant?: "home" | "page";
|
||||||
|
className?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type HeroScrollLinkProps = {
|
||||||
|
href: string;
|
||||||
|
label: string;
|
||||||
|
className?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const toneClasses: Record<HeroTone, string> = {
|
||||||
|
default: "",
|
||||||
|
accent: "hero-title-accent",
|
||||||
|
soft: "hero-title-accent-soft",
|
||||||
|
};
|
||||||
|
|
||||||
|
const lineAlignClasses: Record<HeroLineAlign, string> = {
|
||||||
|
start: "self-start text-start",
|
||||||
|
center: "self-center text-center",
|
||||||
|
end: "self-end text-end",
|
||||||
|
};
|
||||||
|
|
||||||
|
export function HeroShell({
|
||||||
|
children,
|
||||||
|
className,
|
||||||
|
compactBackdrop = false,
|
||||||
|
containerClassName,
|
||||||
|
contentClassName,
|
||||||
|
showBridges = false,
|
||||||
|
size = "default",
|
||||||
|
variant = "home",
|
||||||
|
}: HeroShellProps) {
|
||||||
|
return (
|
||||||
|
<section
|
||||||
|
className={cn(
|
||||||
|
"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]",
|
||||||
|
className,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<HeroMotionBackdrop compact={compactBackdrop} />
|
||||||
|
{showBridges ? <div className="hero-header-bridge" /> : null}
|
||||||
|
{showBridges ? <div className="hero-content-bridge" /> : null}
|
||||||
|
|
||||||
|
<Container
|
||||||
|
size={size}
|
||||||
|
className={cn(
|
||||||
|
"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",
|
||||||
|
containerClassName,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
"mx-auto flex w-full flex-col items-center text-center",
|
||||||
|
variant === "home" ? "max-w-[58rem]" : "max-w-[46rem]",
|
||||||
|
contentClassName,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
</Container>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function HeroTitle({
|
||||||
|
lines,
|
||||||
|
locale = "en",
|
||||||
|
variant = "home",
|
||||||
|
className,
|
||||||
|
}: HeroTitleProps) {
|
||||||
|
const isArabic = locale === "ar";
|
||||||
|
|
||||||
|
return (
|
||||||
|
<h1
|
||||||
|
className={cn(
|
||||||
|
"text-balance font-semibold text-[hsl(var(--hero-ink))]",
|
||||||
|
variant === "home"
|
||||||
|
? 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-[40rem] flex-col gap-y-1 text-[clamp(3.1rem,11vw,6.3rem)] leading-[0.94] tracking-[-0.06em] sm:max-w-[46rem]"
|
||||||
|
: "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]",
|
||||||
|
className,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{lines.map((line, index) => (
|
||||||
|
<span
|
||||||
|
key={`${index}-${line.text}`}
|
||||||
|
className={cn(
|
||||||
|
"hero-title-line",
|
||||||
|
toneClasses[line.tone ?? "default"],
|
||||||
|
lineAlignClasses[line.align ?? "center"],
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{line.text}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</h1>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function HeroScrollLink({
|
||||||
|
href,
|
||||||
|
label,
|
||||||
|
className,
|
||||||
|
}: HeroScrollLinkProps) {
|
||||||
|
return (
|
||||||
|
<a href={href} aria-label={label} className={cn("hero-scroll-link", className)}>
|
||||||
|
<ArrowDown className="h-5 w-5" />
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user