Files
salar-store/components/PageHero.tsx
T

47 lines
1.3 KiB
TypeScript

import Link from "next/link";
type Crumb = {
name: string;
href?: string;
};
type Props = {
title: string;
english: string;
crumbs?: Crumb[];
};
export function PageHero({ title, english, crumbs }: Props) {
const trail = crumbs ?? [{ name: title }];
return (
<div className="page-hero border-b border-black/5">
<div className="container-site flex items-end justify-between gap-4 py-4 md:py-5">
<div className="min-w-0">
<p className="text-xs text-zinc-400 mb-1">
<Link href="/" className="hover:text-brand">
خانه
</Link>
{trail.map((crumb) => (
<span key={crumb.name}>
<span className="mx-1.5">/</span>
{crumb.href ? (
<Link href={crumb.href} className="hover:text-brand">
{crumb.name}
</Link>
) : (
<span>{crumb.name}</span>
)}
</span>
))}
</p>
<h1 className="text-xl md:text-2xl font-extrabold">{title}</h1>
</div>
<p dir="ltr" className="shrink-0 pb-0.5 font-carter text-[10px] tracking-[0.4em] text-zinc-400 uppercase">
{english}
</p>
</div>
</div>
);
}