import { LinkIncludingShortenedCollectionAndTags } from "@/types/global"; import Image from "next/image"; import isValidUrl from "@/lib/shared/isValidUrl"; import React, { useState } from "react"; import Icon from "@/components/Icon"; import { IconWeight } from "@phosphor-icons/react"; import clsx from "clsx"; export default function LinkIcon({ link, className, hideBackground, onClick, }: { link: LinkIncludingShortenedCollectionAndTags; className?: string; hideBackground?: boolean; onClick?: Function; }) { let iconClasses: string = clsx( "rounded flex item-center justify-center shadow select-none z-10 w-12 h-12", !hideBackground && "rounded-md bg-white backdrop-blur-lg bg-opacity-50 p-1", className ); const url = isValidUrl(link.url || "") && link.url ? new URL(link.url) : undefined; const [faviconLoaded, setFaviconLoaded] = useState(false); return (