import { LinkIncludingShortenedCollectionAndTags } from "@/types/global"; import Image from "next/image"; import isValidUrl from "@/lib/shared/isValidUrl"; import React from "react"; export default function LinkIcon({ link, width, }: { link: LinkIncludingShortenedCollectionAndTags; width?: string; }) { const url = isValidUrl(link.url || "") && link.url ? new URL(link.url) : undefined; const iconClasses: string = "bg-white text-primary shadow rounded-md border-[2px] border-white select-none z-10" + " " + (width || "w-12"); return (
{link.url && url ? ( { const target = e.target as HTMLElement; target.style.display = "none"; }} /> ) : link.type === "pdf" ? ( ) : link.type === "image" ? ( ) : undefined}
); }