import { cn } from '@/lib/utils' import { TEmoji } from '@/types' import { Heart } from 'lucide-react' import { HTMLAttributes, useState } from 'react' export default function Emoji({ emoji, classNames }: Omit, 'className'> & { emoji: TEmoji | string classNames?: { text?: string img?: string } }) { const [hasError, setHasError] = useState(false) if (typeof emoji === 'string') { return emoji === '+' ? ( ) : ( {emoji} ) } if (hasError) { return ( {`:${emoji.shortcode}:`} ) } return ( {emoji.shortcode} { setHasError(false) }} onError={() => { setHasError(true) }} /> ) }