Skip to content

Commit b732985

Browse files
committed
Swap class-variance-authority and clsx for tailwind-variants.
1 parent eb04c0e commit b732985

File tree

4 files changed

+50
-88
lines changed

4 files changed

+50
-88
lines changed

browser-extension/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22
"author": "DiffPlug",
33
"dependencies": {
44
"@primer/octicons-react": "^19.18.0",
5-
"@radix-ui/react-slot": "^1.2.3",
65
"@types/react": "^19.1.12",
76
"@types/react-dom": "^19.1.9",
87
"@wxt-dev/webextension-polyfill": "^1.0.0",
9-
"class-variance-authority": "^0.7.1",
10-
"clsx": "^2.1.1",
118
"highlight.js": "^11.11.1",
129
"lucide-react": "^0.543.0",
1310
"overtype": "workspace:*",
1411
"react": "^19.1.1",
1512
"react-dom": "^19.1.1",
1613
"tailwind-merge": "^3.3.1",
14+
"tailwind-variants": "^3.1.1",
1715
"webextension-polyfill": "^0.12.0"
1816
},
1917
"description": "Syntax highlighting and autosave for comments on GitHub (and other other markdown-friendly websites).",

browser-extension/src/components/Badge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { VariantProps } from 'class-variance-authority'
21
import { twMerge } from 'tailwind-merge'
2+
import type { VariantProps } from 'tailwind-variants'
33
import { badgeCVA, typeIcons } from '@/components/design'
44

55
export type BadgeProps = VariantProps<typeof badgeCVA> & {

browser-extension/src/components/design.tsx

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { cva } from 'class-variance-authority'
21
import {
32
Clock,
43
Code,
@@ -12,40 +11,39 @@ import {
1211
TextSelect,
1312
Trash2,
1413
} from 'lucide-react'
14+
import { tv } from 'tailwind-variants'
1515

16-
// CVA configuration for stat badges
17-
export const badgeCVA = cva(
18-
'inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-normal h-5',
19-
{
20-
defaultVariants: {
21-
clickable: false,
16+
// TV configuration for stat badges
17+
export const badgeCVA = tv({
18+
base: 'inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-normal h-5',
19+
defaultVariants: {
20+
clickable: false,
21+
},
22+
variants: {
23+
clickable: {
24+
false: '',
25+
true: 'cursor-pointer border border-transparent hover:border-current border-dashed',
26+
},
27+
selected: {
28+
false: '',
29+
true: '!border-solid !border-current',
2230
},
23-
variants: {
24-
clickable: {
25-
false: '',
26-
true: 'cursor-pointer border border-transparent hover:border-current border-dashed',
27-
},
28-
selected: {
29-
false: '',
30-
true: '!border-solid !border-current',
31-
},
32-
type: {
33-
blank: 'bg-transparent text-gray-700',
34-
code: 'bg-pink-50 text-pink-700',
35-
hideTrashed: 'bg-transparent text-gray-700',
36-
image: 'bg-purple-50 text-purple-700',
37-
link: 'bg-blue-50 text-blue-700',
38-
open: 'bg-cyan-50 text-cyan-700',
39-
sent: 'bg-green-50 text-green-700',
40-
settings: 'bg-gray-50 text-gray-700',
41-
text: 'bg-gray-50 text-gray-700',
42-
time: 'bg-gray-50 text-gray-700',
43-
trashed: 'bg-gray-50 text-yellow-700',
44-
unsent: 'bg-amber-100 text-amber-700',
45-
},
31+
type: {
32+
blank: 'bg-transparent text-gray-700',
33+
code: 'bg-pink-50 text-pink-700',
34+
hideTrashed: 'bg-transparent text-gray-700',
35+
image: 'bg-purple-50 text-purple-700',
36+
link: 'bg-blue-50 text-blue-700',
37+
open: 'bg-cyan-50 text-cyan-700',
38+
sent: 'bg-green-50 text-green-700',
39+
settings: 'bg-gray-50 text-gray-700',
40+
text: 'bg-gray-50 text-gray-700',
41+
time: 'bg-gray-50 text-gray-700',
42+
trashed: 'bg-gray-50 text-yellow-700',
43+
unsent: 'bg-amber-100 text-amber-700',
4644
},
4745
},
48-
)
46+
})
4947

5048
// Map types to their icons
5149
export const typeIcons = {

pnpm-lock.yaml

Lines changed: 19 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)