This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
import type { Metadata } from "next";
|
||||
import { ArrowLeft, CalendarDays, FolderKanban, Tag } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
import { Container } from "@/components/layout/container";
|
||||
import { MotionFade } from "@/components/motion-fade";
|
||||
import { routing } from "@/i18n/routing";
|
||||
import { getPortfolioItem, pickText, portfolioItems, resolveLocale } from "@/lib/site-data";
|
||||
import { buildLocalizedMetadata } from "@/lib/metadata";
|
||||
import { getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||
import { getPortfolioItem, pickText, portfolioItems } from "@/lib/site-data";
|
||||
import { AppCard } from "@/components/ui/app-card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { CardContent } from "@/components/ui/card";
|
||||
|
||||
type PortfolioItemPageProps = {
|
||||
params: {
|
||||
@@ -22,7 +30,30 @@ export function generateStaticParams() {
|
||||
);
|
||||
}
|
||||
|
||||
export default function PortfolioItemPage({
|
||||
export async function generateMetadata({
|
||||
params: { locale, slug },
|
||||
}: PortfolioItemPageProps): Promise<Metadata> {
|
||||
const localeKey = resolveLocale(locale);
|
||||
const item = getPortfolioItem(slug);
|
||||
|
||||
if (!item) {
|
||||
return buildLocalizedMetadata({
|
||||
locale: localeKey,
|
||||
pathname: `/portfolio/${slug}`,
|
||||
title: "Portfolio",
|
||||
description: "Portfolio item",
|
||||
});
|
||||
}
|
||||
|
||||
return buildLocalizedMetadata({
|
||||
locale: localeKey,
|
||||
pathname: `/portfolio/${slug}`,
|
||||
title: pickText(item.title, localeKey),
|
||||
description: pickText(item.summary, localeKey),
|
||||
});
|
||||
}
|
||||
|
||||
export default async function PortfolioItemPage({
|
||||
params: { locale, slug },
|
||||
}: PortfolioItemPageProps) {
|
||||
const localeKey = resolveLocale(locale);
|
||||
@@ -32,100 +63,83 @@ export default function PortfolioItemPage({
|
||||
notFound();
|
||||
}
|
||||
|
||||
const copy =
|
||||
localeKey === "de"
|
||||
? {
|
||||
back: "Zurueck zum Portfolio",
|
||||
challenge: "Herausforderung",
|
||||
solution: "Loesung",
|
||||
outcome: "Ergebnis",
|
||||
challengeText:
|
||||
"Das Projekt brauchte eine klare Informationsarchitektur und schnellere Ladezeiten.",
|
||||
solutionText:
|
||||
"Wir haben Design, Komponenten und Content in einem modularen System aufgebaut.",
|
||||
outcomeText:
|
||||
"Das Team kann Inhalte schneller ausrollen und Nutzer finden schneller zum Ziel.",
|
||||
}
|
||||
: {
|
||||
back: "Back to portfolio",
|
||||
challenge: "Challenge",
|
||||
solution: "Solution",
|
||||
outcome: "Outcome",
|
||||
challengeText:
|
||||
"The project needed clearer information architecture and faster performance.",
|
||||
solutionText:
|
||||
"We built design, components and content in a modular system.",
|
||||
outcomeText:
|
||||
"The team ships content faster and users reach goals more quickly.",
|
||||
};
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "portfolioDetail" });
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex w-full max-w-5xl flex-col gap-8 px-4 py-10 sm:px-6 lg:px-8 lg:py-14">
|
||||
<Container size="wide" className="flex flex-col gap-section py-10 lg:py-14">
|
||||
<MotionFade>
|
||||
<section className="rounded-3xl border border-default bg-surface p-6 lg:p-10">
|
||||
<Link
|
||||
href={`/${localeKey}/portfolio`}
|
||||
className="inline-flex items-center gap-2 text-sm text-muted transition hover:text-fg"
|
||||
>
|
||||
<ArrowLeft className="h-4 w-4" />
|
||||
{copy.back}
|
||||
</Link>
|
||||
<h1 className="mt-5 text-3xl font-semibold text-fg sm:text-4xl">
|
||||
{pickText(item.title, localeKey)}
|
||||
</h1>
|
||||
<p className="mt-4 text-base text-muted sm:text-lg">
|
||||
{pickText(item.summary, localeKey)}
|
||||
</p>
|
||||
<AppCard level={3}>
|
||||
<CardContent className="p-6 lg:p-10">
|
||||
<Button asChild variant="ghost" className="h-auto px-0 py-0 text-sm">
|
||||
<Link href={getLocalizedPath(localeKey, "/portfolio")}>
|
||||
<ArrowLeft className="h-4 w-4" />
|
||||
{t("back")}
|
||||
</Link>
|
||||
</Button>
|
||||
|
||||
<div className="mt-6 flex flex-wrap gap-3 text-sm text-muted">
|
||||
<span className="inline-flex items-center gap-2 rounded-lg border border-default bg-surface-soft px-3 py-2 ">
|
||||
<Tag className="h-4 w-4" />
|
||||
{pickText(item.category, localeKey)}
|
||||
</span>
|
||||
<span className="inline-flex items-center gap-2 rounded-lg border border-default bg-surface-soft px-3 py-2 ">
|
||||
<CalendarDays className="h-4 w-4" />
|
||||
{item.year}
|
||||
</span>
|
||||
<span className="inline-flex items-center gap-2 rounded-lg border border-default bg-surface-soft px-3 py-2 ">
|
||||
<FolderKanban className="h-4 w-4" />
|
||||
{item.slug}
|
||||
</span>
|
||||
</div>
|
||||
</section>
|
||||
<h1 className="mt-5 text-3xl font-semibold text-foreground sm:text-4xl">
|
||||
{pickText(item.title, localeKey)}
|
||||
</h1>
|
||||
<p className="mt-4 text-base text-muted-foreground sm:text-lg">
|
||||
{pickText(item.summary, localeKey)}
|
||||
</p>
|
||||
|
||||
<div className="mt-6 flex flex-wrap gap-3 text-sm text-foreground/80">
|
||||
{[
|
||||
{
|
||||
icon: Tag,
|
||||
label: pickText(item.category, localeKey),
|
||||
},
|
||||
{
|
||||
icon: CalendarDays,
|
||||
label: item.year,
|
||||
},
|
||||
{
|
||||
icon: FolderKanban,
|
||||
label: item.slug,
|
||||
},
|
||||
].map((meta) => {
|
||||
const Icon = meta.icon;
|
||||
|
||||
return (
|
||||
<AppCard key={meta.label} level={2}>
|
||||
<CardContent className="flex items-center gap-2 p-3">
|
||||
<Icon className="h-4 w-4 text-brand-primary" />
|
||||
{meta.label}
|
||||
</CardContent>
|
||||
</AppCard>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</CardContent>
|
||||
</AppCard>
|
||||
</MotionFade>
|
||||
|
||||
<div className="grid gap-4 md:grid-cols-3">
|
||||
<MotionFade delay={0.05}>
|
||||
<article className="rounded-2xl border border-default bg-surface p-5 ">
|
||||
<h2 className="text-lg font-semibold text-fg">
|
||||
{copy.challenge}
|
||||
</h2>
|
||||
<p className="mt-2 text-sm text-muted">
|
||||
{copy.challengeText}
|
||||
</p>
|
||||
</article>
|
||||
</MotionFade>
|
||||
<MotionFade delay={0.1}>
|
||||
<article className="rounded-2xl border border-default bg-surface p-5 ">
|
||||
<h2 className="text-lg font-semibold text-fg">
|
||||
{copy.solution}
|
||||
</h2>
|
||||
<p className="mt-2 text-sm text-muted">
|
||||
{copy.solutionText}
|
||||
</p>
|
||||
</article>
|
||||
</MotionFade>
|
||||
<MotionFade delay={0.15}>
|
||||
<article className="rounded-2xl border border-default bg-surface p-5 ">
|
||||
<h2 className="text-lg font-semibold text-fg">
|
||||
{copy.outcome}
|
||||
</h2>
|
||||
<p className="mt-2 text-sm text-muted">
|
||||
{copy.outcomeText}
|
||||
</p>
|
||||
</article>
|
||||
</MotionFade>
|
||||
{[
|
||||
{
|
||||
title: t("challenge"),
|
||||
text: t("challengeText"),
|
||||
},
|
||||
{
|
||||
title: t("solution"),
|
||||
text: t("solutionText"),
|
||||
},
|
||||
{
|
||||
title: t("outcome"),
|
||||
text: t("outcomeText"),
|
||||
},
|
||||
].map((section, index) => (
|
||||
<MotionFade key={section.title} delay={0.05 * (index + 1)}>
|
||||
<AppCard>
|
||||
<CardContent className="p-5">
|
||||
<h2 className="text-lg font-semibold text-foreground">{section.title}</h2>
|
||||
<p className="mt-2 text-sm text-muted-foreground">{section.text}</p>
|
||||
</CardContent>
|
||||
</AppCard>
|
||||
</MotionFade>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
import type { Metadata } from "next";
|
||||
import { ArrowUpRight, CalendarDays, FolderKanban } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
|
||||
import { Container } from "@/components/layout/container";
|
||||
import { MotionFade } from "@/components/motion-fade";
|
||||
import { pickText, portfolioItems, resolveLocale } from "@/lib/site-data";
|
||||
import { buildLocalizedMetadata } from "@/lib/metadata";
|
||||
import { AppCard } from "@/components/ui/app-card";
|
||||
import { CardContent } from "@/components/ui/card";
|
||||
import { getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||
import { pickText, portfolioItems } from "@/lib/site-data";
|
||||
|
||||
type PortfolioPageProps = {
|
||||
params: {
|
||||
@@ -10,68 +17,76 @@ type PortfolioPageProps = {
|
||||
};
|
||||
};
|
||||
|
||||
export default function PortfolioPage({ params: { locale } }: PortfolioPageProps) {
|
||||
export async function generateMetadata({
|
||||
params: { locale },
|
||||
}: PortfolioPageProps): Promise<Metadata> {
|
||||
const localeKey = resolveLocale(locale);
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "portfolioPage" });
|
||||
|
||||
const copy =
|
||||
localeKey === "de"
|
||||
? {
|
||||
title: "Portfolio",
|
||||
intro: "Eine Auswahl von Projekten mit Fokus auf Klarheit und Ergebnis.",
|
||||
open: "Projekt oeffnen",
|
||||
}
|
||||
: {
|
||||
title: "Portfolio",
|
||||
intro: "Selected projects with a focus on clarity and outcomes.",
|
||||
open: "Open project",
|
||||
};
|
||||
return buildLocalizedMetadata({
|
||||
locale: localeKey,
|
||||
pathname: "/portfolio",
|
||||
title: t("title"),
|
||||
description: t("intro"),
|
||||
});
|
||||
}
|
||||
|
||||
export default async function PortfolioPage({ params: { locale } }: PortfolioPageProps) {
|
||||
const localeKey = resolveLocale(locale);
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "portfolioPage" });
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex w-full max-w-6xl flex-col gap-8 px-4 py-10 sm:px-6 lg:px-8 lg:py-14">
|
||||
<Container className="flex flex-col gap-section py-10 lg:py-14">
|
||||
<MotionFade>
|
||||
<section className="rounded-3xl border border-default bg-surface p-6 lg:p-10">
|
||||
<div className="flex items-center gap-3">
|
||||
<FolderKanban className="h-5 w-5 text-muted-strong" />
|
||||
<h1 className="text-3xl font-semibold text-fg sm:text-4xl">
|
||||
{copy.title}
|
||||
</h1>
|
||||
</div>
|
||||
<p className="mt-4 max-w-3xl text-base text-muted sm:text-lg">
|
||||
{copy.intro}
|
||||
</p>
|
||||
</section>
|
||||
<AppCard level={3}>
|
||||
<CardContent className="p-6 lg:p-10">
|
||||
<div className="flex items-center gap-3">
|
||||
<FolderKanban className="h-5 w-5 text-brand-primary" />
|
||||
<h1 className="text-3xl font-semibold text-foreground sm:text-4xl">
|
||||
{t("title")}
|
||||
</h1>
|
||||
</div>
|
||||
<p className="mt-4 max-w-3xl text-base text-muted-foreground sm:text-lg">
|
||||
{t("intro")}
|
||||
</p>
|
||||
</CardContent>
|
||||
</AppCard>
|
||||
</MotionFade>
|
||||
|
||||
<section className="grid gap-4 md:grid-cols-2">
|
||||
{portfolioItems.map((item, index) => (
|
||||
<MotionFade key={item.slug} delay={index * 0.05}>
|
||||
<Link
|
||||
href={`/${localeKey}/portfolio/${item.slug}`}
|
||||
className="group block rounded-2xl border border-default bg-surface p-5 transition group-hover-border-strong "
|
||||
>
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<p className="text-sm text-subtle">
|
||||
{pickText(item.category, localeKey)}
|
||||
</p>
|
||||
<p className="inline-flex items-center gap-1 text-xs text-subtle">
|
||||
<CalendarDays className="h-3.5 w-3.5" />
|
||||
{item.year}
|
||||
</p>
|
||||
</div>
|
||||
<h2 className="mt-3 text-xl font-semibold text-fg">
|
||||
{pickText(item.title, localeKey)}
|
||||
</h2>
|
||||
<p className="mt-2 text-sm text-muted">
|
||||
{pickText(item.summary, localeKey)}
|
||||
</p>
|
||||
<p className="group-hover-fg mt-4 inline-flex items-center gap-2 text-sm font-medium text-muted-strong">
|
||||
{copy.open}
|
||||
<ArrowUpRight className="h-4 w-4" />
|
||||
</p>
|
||||
</Link>
|
||||
<AppCard interactive>
|
||||
<CardContent className="p-5">
|
||||
<Link
|
||||
href={getLocalizedPath(localeKey, `/portfolio/${item.slug}`)}
|
||||
className="group block"
|
||||
>
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<p className="text-sm text-muted-foreground/80">
|
||||
{pickText(item.category, localeKey)}
|
||||
</p>
|
||||
<p className="inline-flex items-center gap-1 text-xs text-muted-foreground/80">
|
||||
<CalendarDays className="h-3.5 w-3.5" />
|
||||
{item.year}
|
||||
</p>
|
||||
</div>
|
||||
<h2 className="mt-3 text-xl font-semibold text-foreground">
|
||||
{pickText(item.title, localeKey)}
|
||||
</h2>
|
||||
<p className="mt-2 text-sm text-muted-foreground">
|
||||
{pickText(item.summary, localeKey)}
|
||||
</p>
|
||||
<p className="mt-4 inline-flex items-center gap-2 text-sm font-medium text-foreground/80 group-hover:text-foreground">
|
||||
{t("open")}
|
||||
<ArrowUpRight className="h-4 w-4" />
|
||||
</p>
|
||||
</Link>
|
||||
</CardContent>
|
||||
</AppCard>
|
||||
</MotionFade>
|
||||
))}
|
||||
</section>
|
||||
</div>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user