50 lines
1.7 KiB
TypeScript
50 lines
1.7 KiB
TypeScript
import { Link } from '@inertiajs/react';
|
|
import { modalityLabels } from '@/components/opportunity-search-filters';
|
|
import { offerPrice, type PublicOffer } from '@/lib/public-offer';
|
|
import { card } from '@/pages/investment/shared';
|
|
|
|
export default function PublicOfferCard({
|
|
offer,
|
|
detail = false,
|
|
}: {
|
|
offer: PublicOffer;
|
|
detail?: boolean;
|
|
}) {
|
|
const Heading = detail ? 'h1' : 'h2';
|
|
return (
|
|
<article className={`${card} min-w-0 space-y-3 break-words`}>
|
|
<p className="text-sm text-slate-600">
|
|
{modalityLabels[offer.category]} ·{' '}
|
|
{offer.location.map((node) => node.name).join(' / ') ||
|
|
'Localização não indicada'}
|
|
</p>
|
|
<Heading className="text-xl font-semibold">
|
|
{detail ? (
|
|
offer.title
|
|
) : (
|
|
<Link
|
|
className="underline decoration-emerald-700 underline-offset-4"
|
|
href={offer.url}
|
|
>
|
|
{offer.title}
|
|
</Link>
|
|
)}
|
|
</Heading>
|
|
<p className="whitespace-pre-line">{offer.summary}</p>
|
|
<p className="font-semibold text-emerald-900">
|
|
{offerPrice(offer.price)}
|
|
</p>
|
|
<p className="text-sm text-slate-600">
|
|
Publicada em{' '}
|
|
{new Date(offer.published_at).toLocaleDateString('pt-MZ')}
|
|
</p>
|
|
{offer.expires_at && (
|
|
<p className="text-sm text-slate-600">
|
|
Validade até{' '}
|
|
{new Date(offer.expires_at).toLocaleString('pt-MZ')}
|
|
</p>
|
|
)}
|
|
</article>
|
|
);
|
|
}
|