26 lines
1.1 KiB
TypeScript
26 lines
1.1 KiB
TypeScript
import { PageMeta, PagePublic } from "@/lib/pages/types";
|
|
import { CalendarIcon, Globe2Icon } from "lucide-react";
|
|
import Link from "next/link";
|
|
import { Badge } from "./ui/badge";
|
|
import { formatDate } from "@/lib/utils";
|
|
|
|
export function NewsCard({ news }: { news: PagePublic }) {
|
|
return (
|
|
<div className="flex flex-col gap-1">
|
|
<Link href={`/news/${news.slug}`} className="w-max">
|
|
<h2 className="hover:underline underline-offset-8 decoration-2 cursor-pointer">{news.title}</h2>
|
|
</Link>
|
|
<div className="flex flex-col md:flex-row gap-2 md:gap-8 md:items-center">
|
|
<div className="flex flex-row gap-4 md:gap-8">
|
|
<p className="flex gap-2 items-center"><CalendarIcon size={16} />{formatDate(news.publishedAt)}</p>
|
|
{(news?.meta as PageMeta)?.location && <p className="flex gap-2 items-center"><Globe2Icon size={16} />{(news.meta as PageMeta)?.location}</p>}
|
|
</div>
|
|
<div className="hidden md:flex flex-row gap-4">
|
|
{((news.meta as PageMeta)?.tags)?.map((tag) => (
|
|
<Badge key={tag}>{tag}</Badge>
|
|
))}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
} |