Refactor site hero and localized branding UI

This commit is contained in:
MOH
2026-03-08 05:13:10 +01:00
parent 9edb162148
commit 2bda611a3b
35 changed files with 682 additions and 234 deletions
+78 -114
View File
@@ -1,9 +1,13 @@
import type { Metadata } from "next";
import {
ArrowRight,
BadgeCheck,
Blocks,
BriefcaseBusiness,
Boxes,
Mail,
ChartNoAxesCombined,
Globe,
Package2,
Search,
} from "lucide-react";
import Link from "next/link";
import { getTranslations } from "next-intl/server";
@@ -17,11 +21,6 @@ import { AppCard } from "@/components/ui/app-card";
import { Button } from "@/components/ui/button";
import { CardContent } from "@/components/ui/card";
import { getLocalizedPath, resolveLocale } from "@/lib/locale";
import {
getLocalizedValue,
getPublishedPortfolioProjects,
} from "@/lib/portfolio";
import { pickText, productItems } from "@/lib/site-data";
type HomePageProps = {
params: {
@@ -29,6 +28,16 @@ type HomePageProps = {
};
};
const serviceIcons = [
BriefcaseBusiness,
Globe,
Package2,
Blocks,
Search,
ChartNoAxesCombined,
BadgeCheck,
];
export const dynamic = "force-dynamic";
export async function generateMetadata({
@@ -51,9 +60,16 @@ export async function generateMetadata({
export default async function HomePage({ params: { locale } }: HomePageProps) {
const localeKey = resolveLocale(locale);
const featuredProjects = (await getPublishedPortfolioProjects()).slice(0, 3);
const featuredProducts = productItems.slice(0, 3);
const t = await getTranslations({ locale: localeKey, namespace: "homepage" });
const serviceItems = [
t("serviceBrand"),
t("serviceWebsite"),
t("serviceStore"),
t("serviceWordPress"),
t("serviceSeo"),
t("serviceTracking"),
t("serviceSystem"),
];
return (
<>
@@ -66,116 +82,64 @@ export default async function HomePage({ params: { locale } }: HomePageProps) {
contactLabel={t("toContact")}
/>
<Container className="flex flex-col gap-section pb-12 lg:pb-16">
<Container className="relative z-10 -mt-6 flex flex-col gap-section pb-12 lg:-mt-8 lg:pb-16">
<MotionFade delay={0.05}>
<AppCard>
<CardContent className="p-6 lg:p-8">
<div className="mb-6 flex items-center justify-between gap-4">
<div>
<h2 className="text-2xl font-semibold text-foreground">
{t("portfolioTitle")}
</h2>
<p className="mt-2 text-sm text-muted-foreground">
{t("portfolioText")}
</p>
</div>
<BriefcaseBusiness className="h-5 w-5 text-muted-foreground" />
</div>
<div className="grid gap-4 md:grid-cols-3">
{featuredProjects.map((item) => (
<AppCard key={item.slug} interactive>
<CardContent className="p-5">
<Link
href={getLocalizedPath(localeKey, `/portfolio/${item.slug}`)}
className="group block"
>
<p className="text-sm text-muted-foreground/80">
{getLocalizedValue(item.category.name, localeKey)} - {item.projectYear}
</p>
<h3 className="mt-2 text-lg font-semibold text-foreground">
{getLocalizedValue(item.title, localeKey)}
</h3>
<p className="mt-2 text-sm text-muted-foreground">
{getLocalizedValue(item.summary, localeKey)}
</p>
<span className="mt-4 inline-flex items-center gap-2 text-sm font-medium text-foreground/80 group-hover:text-foreground">
{t("toPortfolio")}
<AppCard
level="inverse"
className="overflow-hidden border border-white/6 bg-[linear-gradient(145deg,hsl(var(--foreground)),hsl(221_42%_10%))] text-primary-foreground"
>
<CardContent className="p-6 lg:p-10">
<div className="grid gap-8 lg:grid-cols-[minmax(0,1.05fr)_minmax(0,1fr)] lg:items-start">
<div>
<p className="text-sm font-medium tracking-[0.08em] text-primary-foreground/62">
{t("servicesEyebrow")}
</p>
<h2 className="mt-4 max-w-[12ch] text-balance text-4xl font-semibold leading-[0.92] tracking-[-0.06em] text-primary-foreground sm:text-5xl lg:text-6xl">
{t("servicesTitle")}
</h2>
<p className="mt-5 max-w-[34rem] text-sm leading-7 text-primary-foreground/76 sm:text-base">
{t("servicesText")}
</p>
<div className="mt-7 flex flex-wrap gap-3">
<Button asChild size="lg" variant="secondary" className="min-w-[11rem]">
<Link href={getLocalizedPath(localeKey, "/contact")}>
{t("servicesPrimaryCta")}
<ArrowRight className="h-4 w-4" />
</span>
</Link>
</CardContent>
</AppCard>
))}
</div>
</CardContent>
</AppCard>
</MotionFade>
<MotionFade delay={0.1}>
<AppCard>
<CardContent className="p-6 lg:p-8">
<div className="mb-6 flex items-center justify-between gap-4">
<div>
<h2 className="text-2xl font-semibold text-foreground">
{t("productsTitle")}
</h2>
<p className="mt-2 text-sm text-muted-foreground">
{t("productsText")}
</p>
</div>
<Boxes className="h-5 w-5 text-muted-foreground" />
</div>
<div className="grid gap-4 md:grid-cols-3">
{featuredProducts.map((item) => (
<AppCard key={item.slug} interactive>
<CardContent className="p-5">
<Link
href={getLocalizedPath(localeKey, `/products/${item.slug}`)}
className="group block"
</Link>
</Button>
<Button
asChild
size="lg"
variant="outline"
className="min-w-[11rem] border-white/16 bg-white/6 text-primary-foreground hover:bg-white/10 hover:text-primary-foreground"
>
<p className="text-sm text-muted-foreground/80">
{pickText(item.segment, localeKey)}
</p>
<h3 className="mt-2 text-lg font-semibold text-foreground">
{pickText(item.name, localeKey)}
</h3>
<p className="mt-2 text-sm text-muted-foreground">
{pickText(item.summary, localeKey)}
</p>
<p className="mt-3 text-sm font-medium text-foreground/80">
{pickText(item.price, localeKey)}
</p>
</Link>
</CardContent>
</AppCard>
))}
</div>
</CardContent>
</AppCard>
</MotionFade>
<Link href={getLocalizedPath(localeKey, "/portfolio")}>
{t("servicesSecondaryCta")}
</Link>
</Button>
</div>
</div>
<MotionFade delay={0.15}>
<AppCard level="inverse">
<CardContent className="p-6 lg:p-8">
<div className="flex flex-col gap-4 md:flex-row md:items-center md:justify-between">
<div>
<p className="inline-flex items-center gap-2 text-sm font-medium text-primary-foreground/80">
<Mail className="h-4 w-4" />
{t("ctaTitle")}
</p>
<p className="mt-2 max-w-2xl text-sm text-primary-foreground/88 sm:text-base">
{t("ctaText")}
</p>
<div className="grid gap-3 sm:grid-cols-2">
{serviceItems.map((item, index) => {
const Icon = serviceIcons[index];
return (
<div
key={item}
className="rounded-nested border border-white/10 bg-white/6 p-4 shadow-[inset_0_1px_0_rgba(255,255,255,0.08)] backdrop-blur-sm transition-colors hover:bg-white/8"
>
<Icon className="h-5 w-5 text-primary-foreground/72" />
<p className="mt-4 text-sm font-medium leading-6 text-primary-foreground/88 sm:text-base">
{item}
</p>
</div>
);
})}
</div>
</div>
<Button asChild variant="secondary">
<Link href={getLocalizedPath(localeKey, "/contact")}>
{t("toContact")}
<ArrowRight className="h-4 w-4" />
</Link>
</Button>
</div>
</CardContent>
</AppCard>
</CardContent>
</AppCard>
</MotionFade>
</Container>
</>
+4 -1
View File
@@ -34,10 +34,13 @@ export default async function LocaleLayout({
setRequestLocale(locale);
const messages = await getMessages();
const localeClassName = locale === "ar" ? "font-arabic" : "font-latin";
return (
<NextIntlClientProvider messages={messages}>
<div lang={locale} dir={getDirection(locale)}>{children}</div>
<div lang={locale} dir={getDirection(locale)} className={localeClassName}>
{children}
</div>
</NextIntlClientProvider>
);
}