Improve portfolio list card layout with four-column grid.

Show the English title as a low-opacity backdrop behind the Farsi title and move the category label below it.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-08-23 18:07:48 +03:30
co-authored by Cursor
parent 66c51f84a0
commit 37d8e4be91
+27 -11
View File
@@ -143,7 +143,7 @@ export default async function PortfolioListPage({
) : ( ) : (
<div <div
key={`${activeCategory?.slug ?? "all"}-${page}`} key={`${activeCategory?.slug ?? "all"}-${page}`}
className="grid gap-8 sm:grid-cols-2 lg:grid-cols-3" className="grid gap-6 sm:grid-cols-2 lg:grid-cols-4"
> >
{items.map((item, index) => { {items.map((item, index) => {
const image = getPortfolioCoverImage(item); const image = getPortfolioCoverImage(item);
@@ -151,16 +151,24 @@ export default async function PortfolioListPage({
item.categoryName, item.categoryName,
allCategories, allCategories,
); );
const titleFa = item.titleFa || item.title;
const titleEn =
item.titleEn ??
(item.titleFa && item.title !== item.titleFa
? item.title
: null);
return ( return (
<article <article
key={item.id} key={item.id}
className={`reveal group overflow-hidden rounded-2xl border border-line/70 ${ className={`reveal group overflow-hidden rounded-2xl border border-line/70 ${
index % 3 === 1 index % 4 === 1
? "reveal-delay-1" ? "reveal-delay-1"
: index % 3 === 2 : index % 4 === 2
? "reveal-delay-2" ? "reveal-delay-2"
: "" : index % 4 === 3
? "reveal-delay-3"
: ""
}`} }`}
> >
<Link href={`/portfolio/${item.slug}`} className="block"> <Link href={`/portfolio/${item.slug}`} className="block">
@@ -174,16 +182,24 @@ export default async function PortfolioListPage({
) : null} ) : null}
</div> </div>
<div className="px-4 py-4"> <div className="px-4 py-4">
<div className="relative mb-2 min-h-[3.25rem] overflow-hidden">
{titleEn ? (
<p
aria-hidden
className="latin pointer-events-none absolute inset-x-0 top-1/2 z-0 line-clamp-2 -translate-y-1/2 text-[clamp(1rem,2.2vw,1.35rem)] font-light uppercase leading-none tracking-[0.12em] text-ink/[0.07]"
>
{titleEn}
</p>
) : null}
<h2 className="group-text-hover relative z-10 line-clamp-2 whitespace-normal text-base font-normal leading-7 text-ink">
{titleFa}
</h2>
</div>
{categoryFa ? ( {categoryFa ? (
<p className="mb-2 text-[11px] text-muted"> <p className="text-[11px] text-muted">{categoryFa}</p>
{categoryFa}
</p>
) : null} ) : null}
<h2 className="group-text-hover mb-0.5 line-clamp-2 whitespace-normal text-lg font-normal leading-7 text-ink">
{item.titleFa || item.title}
</h2>
{item.abstract ? ( {item.abstract ? (
<p className="line-clamp-3 text-sm leading-6 text-muted"> <p className="mt-2 line-clamp-3 text-sm leading-6 text-muted">
{item.abstract} {item.abstract}
</p> </p>
) : null} ) : null}