'use client' import { getFaviconUrl } from '@thedaviddias/utils/get-favicon-url' import { Globe } from 'lucide-react' import { useState } from 'react' interface FaviconWithFallbackProps { website: string name: string size?: number className?: string } /** * Displays a favicon with automatic fallback to a Globe icon on error * @param props - The component props * @returns React component that handles favicon loading and errors */ export function FaviconWithFallback({ website, name, size = 32, className = 'rounded-lg' }: FaviconWithFallbackProps) { const [imageError, setImageError] = useState(false) if (imageError) { return (
) } return ( {`${name} setImageError(true)} /> ) }