1- import { type JSX , useState } from ' react'
2- import { twMerge } from ' tailwind-merge'
3- import type { VariantProps } from ' tailwind-variants'
4- import { badgeCVA , typeColors , typeIcons } from ' @/components/design'
5- import type { CommentTableRow } from ' @/entrypoints/background'
1+ import { type JSX , useState } from " react"
2+ import { twMerge } from " tailwind-merge"
3+ import type { VariantProps } from " tailwind-variants"
4+ import { badgeCVA , typeColors , typeIcons } from " @/components/design"
5+ import type { CommentTableRow } from " @/entrypoints/background"
66
7- import { CodePreview } from ' ./BadgePopups/CodePreview'
8- import { ImagePreview } from ' ./BadgePopups/ImagePreview'
9- import { LinkPreview } from ' ./BadgePopups/LinkPreview'
10- import { OpenTabPopup } from ' ./BadgePopups/OpenTabPopup'
11- import { TextPreview } from ' ./BadgePopups/TextPreview'
12- import { TimePreview } from ' ./BadgePopups/TimePreview'
7+ import { CodePreview } from " ./BadgePopups/CodePreview"
8+ import { ImagePreview } from " ./BadgePopups/ImagePreview"
9+ import { LinkPreview } from " ./BadgePopups/LinkPreview"
10+ import { OpenTabPopup } from " ./BadgePopups/OpenTabPopup"
11+ import { TextPreview } from " ./BadgePopups/TextPreview"
12+ import { TimePreview } from " ./BadgePopups/TimePreview"
1313
1414const typePopups = {
1515 code : CodePreview ,
@@ -18,7 +18,9 @@ const typePopups = {
1818 open : OpenTabPopup ,
1919 text : TextPreview ,
2020 time : TimePreview ,
21- } satisfies Partial < Record < keyof typeof typeIcons , ( props : BadgePopupProps ) => JSX . Element > >
21+ } satisfies Partial <
22+ Record < keyof typeof typeIcons , ( props : BadgePopupProps ) => JSX . Element >
23+ >
2224
2325export interface BadgePopupProps {
2426 row : CommentTableRow
@@ -34,11 +36,13 @@ const Badge = ({ text, type, data }: BadgeProps) => {
3436 const Icon = typeIcons [ type ]
3537 const [ showTooltip , setShowTooltip ] = useState ( false )
3638 const PopupComponent =
37- showTooltip && type in typePopups && typePopups [ type as keyof typeof typePopups ]
39+ showTooltip &&
40+ type in typePopups &&
41+ typePopups [ type as keyof typeof typePopups ]
3842 return (
3943 < button
40- type = ' button'
41- className = ' relative'
44+ type = " button"
45+ className = " relative"
4246 onMouseEnter = { ( ) => setShowTooltip ( true ) }
4347 onMouseLeave = { ( ) => setShowTooltip ( false ) }
4448 >
@@ -47,17 +51,17 @@ const Badge = ({ text, type, data }: BadgeProps) => {
4751 badgeCVA ( {
4852 clickable : type in typePopups ,
4953 type,
50- } ) ,
54+ } )
5155 ) }
5256 >
53- { type === ' blank' || < Icon className = ' h-3 w-3' /> }
57+ { type === " blank" || < Icon className = " h-3 w-3" /> }
5458 { text || type }
5559 </ span >
5660 { PopupComponent && data && (
5761 < div
5862 className = { twMerge (
59- ' absolute top-full z-10 w-30 rounded border px-2 py-1 text-left text-xs shadow-lg' ,
60- typeColors [ type ] ,
63+ " absolute top-full z-10 w-30 rounded border px-2 py-1 text-left text-xs shadow-lg" ,
64+ typeColors [ type ]
6165 ) }
6266 >
6367 < PopupComponent row = { data } />
0 commit comments