import { faChevronRight } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import Image from "next/image"; import { Link as LinkType, Tag } from "@prisma/client"; import isValidUrl from "@/lib/shared/isValidUrl"; import unescapeString from "@/lib/client/unescapeString"; import { TagIncludingLinkCount } from "@/types/global"; import Link from "next/link"; interface LinksIncludingTags extends LinkType { tags: TagIncludingLinkCount[]; } type Props = { link: LinksIncludingTags; count: number; }; export default function LinkCard({ link, count }: Props) { const url = link.url && isValidUrl(link.url) ? new URL(link.url) : undefined; const formattedDate = new Date( link.createdAt as unknown as string ).toLocaleString("en-US", { year: "numeric", month: "short", day: "numeric", }); return (

{url && ( { const target = e.target as HTMLElement; target.style.display = "none"; }} /> )} {unescapeString(link.name || link.description)}

{link.tags.map((e, i) => ( #{e.name} ))}

{formattedDate}

ยท

{url ? url.host : link.url}
{unescapeString(link.description)}{" "}

Read

); }