Skip to content

Commit 215852b

Browse files
committed
pull preview index out of design.tsx and into Badge.tsx
1 parent 266590b commit 215852b

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/components/Badge.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1-
import { useState } from 'react'
1+
import { type JSX, useState } from 'react'
22
import { twMerge } from 'tailwind-merge'
33
import type { VariantProps } from 'tailwind-variants'
4-
import { badgeCVA, typeColors, typeIcons, typeTooltips } from '@/components/design'
4+
import { badgeCVA, typeColors, typeIcons } from '@/components/design'
5+
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'
11+
12+
const typeTooltips = {
13+
code: CodePreview,
14+
image: ImagePreview,
15+
link: LinkPreview,
16+
text: TextPreview,
17+
time: TimePreview,
18+
} satisfies Partial<Record<keyof typeof typeIcons, () => JSX.Element>>
519

620
export type BadgeProps = VariantProps<typeof badgeCVA> & {
721
type: keyof typeof typeIcons

src/components/design.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@ import {
1111
TextSelect,
1212
Trash2,
1313
} from 'lucide-react'
14-
import type { JSX } from 'react'
1514
import { tv } from 'tailwind-variants'
16-
import { CodePreview } from './BadgePreviews/CodePreview'
17-
import { ImagePreview } from './BadgePreviews/ImagePreview'
18-
import { LinkPreview } from './BadgePreviews/LinkPreview'
19-
import { TextPreview } from './BadgePreviews/TextPreview'
20-
import { TimePreview } from './BadgePreviews/TimePreview'
2115

2216
// Map types to their icons - source of truth for badge types
2317
export const typeIcons = {
@@ -69,11 +63,3 @@ export const badgeCVA = tv({
6963
type: typeColors,
7064
},
7165
})
72-
73-
export const typeTooltips = {
74-
code: CodePreview,
75-
image: ImagePreview,
76-
link: LinkPreview,
77-
text: TextPreview,
78-
time: TimePreview,
79-
} satisfies Partial<Record<keyof typeof typeIcons, () => JSX.Element | undefined>>

0 commit comments

Comments
 (0)