HighlightPreview.tsx raw

   1  import { getEmojiInfosFromEmojiTags } from '@/lib/tag'
   2  import { cn } from '@/lib/utils'
   3  import { Event } from 'nostr-tools'
   4  import { useMemo } from 'react'
   5  import { useTranslation } from 'react-i18next'
   6  import Content from './Content'
   7  
   8  export default function HighlightPreview({
   9    event,
  10    className
  11  }: {
  12    event: Event
  13    className?: string
  14  }) {
  15    const { t } = useTranslation()
  16    const emojiInfos = useMemo(() => getEmojiInfosFromEmojiTags(event.tags), [event])
  17  
  18    return (
  19      <div className={cn('pointer-events-none', className)}>
  20        [{t('Highlight')}]{' '}
  21        <Content content={event.content} emojiInfos={emojiInfos} className="italic pr-0.5" />
  22      </div>
  23    )
  24  }
  25