Skip to content

Commit 15a4050

Browse files
committed
extract typeColors out of badgeCVA so it can be used other places too
1 parent 69343f8 commit 15a4050

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

src/components/design.tsx

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ import { LinkPreview } from './BadgePreviews/LinkPreview'
1919
import { TextPreview } from './BadgePreviews/TextPreview'
2020
import { TimePreview } from './BadgePreviews/TimePreview'
2121

22+
// Type colors definition - single source of truth
23+
export const typeColors = {
24+
blank: 'bg-transparent text-gray-700',
25+
code: 'bg-pink-50 text-pink-700',
26+
hideTrashed: 'bg-transparent text-gray-700',
27+
image: 'bg-purple-50 text-purple-700',
28+
link: 'bg-blue-50 text-blue-700',
29+
open: 'bg-cyan-50 text-cyan-700',
30+
sent: 'bg-green-50 text-green-700',
31+
settings: 'bg-gray-50 text-gray-700',
32+
text: 'bg-gray-50 text-gray-700',
33+
time: 'bg-gray-50 text-gray-700',
34+
trashed: 'bg-gray-50 text-yellow-700',
35+
unsent: 'bg-amber-100 text-amber-700',
36+
} as const
37+
2238
// TV configuration for stat badges
2339
export const badgeCVA = tv({
2440
base: 'inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-normal h-5',
@@ -34,20 +50,7 @@ export const badgeCVA = tv({
3450
false: '',
3551
true: '!border-solid !border-current',
3652
},
37-
type: {
38-
blank: 'bg-transparent text-gray-700',
39-
code: 'bg-pink-50 text-pink-700',
40-
hideTrashed: 'bg-transparent text-gray-700',
41-
image: 'bg-purple-50 text-purple-700',
42-
link: 'bg-blue-50 text-blue-700',
43-
open: 'bg-cyan-50 text-cyan-700',
44-
sent: 'bg-green-50 text-green-700',
45-
settings: 'bg-gray-50 text-gray-700',
46-
text: 'bg-gray-50 text-gray-700',
47-
time: 'bg-gray-50 text-gray-700',
48-
trashed: 'bg-gray-50 text-yellow-700',
49-
unsent: 'bg-amber-100 text-amber-700',
50-
},
53+
type: typeColors,
5154
},
5255
})
5356

0 commit comments

Comments
 (0)