Skip to content

Commit a2cadc6

Browse files
committed
Rename BadgePreviews to BadgePopups. Some are preview popups, some will be other kinds of popup.
1 parent b3b5d86 commit a2cadc6

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

src/components/Badge.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import { twMerge } from 'tailwind-merge'
33
import type { VariantProps } from 'tailwind-variants'
44
import { badgeCVA, typeColors, typeIcons } from '@/components/design'
55

6-
import { CodePreview } from './BadgePreviews/CodePreview'
7-
import { ImagePreview } from './BadgePreviews/ImagePreview'
8-
import { LinkPreview } from './BadgePreviews/LinkPreview'
9-
import { TextPreview } from './BadgePreviews/TextPreview'
10-
import { TimePreview } from './BadgePreviews/TimePreview'
6+
import { CodePreview } from './BadgePopups/CodePreview'
7+
import { ImagePreview } from './BadgePopups/ImagePreview'
8+
import { LinkPreview } from './BadgePopups/LinkPreview'
9+
import { TextPreview } from './BadgePopups/TextPreview'
10+
import { TimePreview } from './BadgePopups/TimePreview'
1111

12-
const typeTooltips = {
12+
const typePopups = {
1313
code: CodePreview,
1414
image: ImagePreview,
1515
link: LinkPreview,
@@ -25,8 +25,8 @@ export type BadgeProps = VariantProps<typeof badgeCVA> & {
2525
const Badge = ({ text, type }: BadgeProps) => {
2626
const Icon = typeIcons[type]
2727
const [showTooltip, setShowTooltip] = useState(false)
28-
const TooltipComponent =
29-
showTooltip && type in typeTooltips && typeTooltips[type as keyof typeof typeTooltips]
28+
const PopupComponent =
29+
showTooltip && type in typePopups && typePopups[type as keyof typeof typePopups]
3030
return (
3131
<button
3232
type='button'
@@ -37,22 +37,22 @@ const Badge = ({ text, type }: BadgeProps) => {
3737
<span
3838
className={twMerge(
3939
badgeCVA({
40-
clickable: type in typeTooltips,
40+
clickable: type in typePopups,
4141
type,
4242
}),
4343
)}
4444
>
4545
{type === 'blank' || <Icon className='h-3 w-3' />}
4646
{text || type}
4747
</span>
48-
{TooltipComponent && (
48+
{PopupComponent && (
4949
<div
5050
className={twMerge(
5151
'absolute top-full z-10 w-30 rounded border px-2 py-1 text-left text-xs shadow-lg',
5252
typeColors[type],
5353
)}
5454
>
55-
<TooltipComponent />
55+
<PopupComponent />
5656
</div>
5757
)}
5858
</button>

0 commit comments

Comments
 (0)