Skip to content

Commit 438b373

Browse files
committed
Navigate design out into its own thing.
1 parent 0fbd95d commit 438b373

File tree

3 files changed

+75
-73
lines changed

3 files changed

+75
-73
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { cva } from 'class-variance-authority'
2+
import {
3+
Clock,
4+
Code,
5+
EyeOff,
6+
Image,
7+
Link,
8+
MailCheck,
9+
MessageSquareDashed,
10+
Monitor,
11+
Settings,
12+
TextSelect,
13+
Trash2,
14+
} from 'lucide-react'
15+
16+
// CVA configuration for stat badges
17+
export const statBadge = 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,
22+
},
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+
},
46+
},
47+
},
48+
)
49+
50+
// Map types to their icons
51+
export const typeIcons = {
52+
blank: Code,
53+
code: Code,
54+
hideTrashed: EyeOff,
55+
image: Image,
56+
link: Link,
57+
open: Monitor,
58+
sent: MailCheck,
59+
settings: Settings,
60+
text: TextSelect,
61+
time: Clock,
62+
trashed: Trash2,
63+
unsent: MessageSquareDashed,
64+
} as const

browser-extension/src/entrypoints/popup/popup.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ function switchToTab(tabId: number, windowId: number): void {
3232

3333
const enhancers = new EnhancerRegistry()
3434

35+
export interface FilterState {
36+
sentFilter: 'both' | 'sent' | 'unsent'
37+
searchQuery: string
38+
showTrashed: boolean
39+
}
40+
3541
function PopupApp() {
3642
const [spots, setSpots] = React.useState<CommentState[]>([])
3743
const [isLoading, setIsLoading] = React.useState(true)

browser-extension/tests/playground/claude.tsx

Lines changed: 5 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,15 @@
1-
import { cva, type VariantProps } from 'class-variance-authority'
2-
import {
3-
Clock,
4-
Code,
5-
Eye,
6-
EyeOff,
7-
Image,
8-
Link,
9-
MailCheck,
10-
MessageSquareDashed,
11-
Monitor,
12-
Search,
13-
Settings,
14-
TextSelect,
15-
Trash2,
16-
} from 'lucide-react'
1+
import type { VariantProps } from 'class-variance-authority'
2+
import { Eye, EyeOff, Search, Settings, Trash2 } from 'lucide-react'
173
import { useMemo, useState } from 'react'
184
import { twMerge } from 'tailwind-merge'
5+
import { statBadge, typeIcons } from '@/components/design'
196
import type { CommentTableRow } from '@/entrypoints/background'
7+
import type { FilterState } from '@/entrypoints/popup/popup'
208
import { EnhancerRegistry } from '@/lib/registries'
219
import { generateMockDrafts } from './replicaData'
2210

23-
interface FilterState {
24-
sentFilter: 'both' | 'sent' | 'unsent'
25-
searchQuery: string
26-
showTrashed: boolean
27-
}
28-
29-
// CVA configuration for stat badges
30-
const statBadge = cva(
31-
'inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-normal h-5',
32-
{
33-
defaultVariants: {
34-
clickable: false,
35-
},
36-
variants: {
37-
clickable: {
38-
false: '',
39-
true: 'cursor-pointer border border-transparent hover:border-current border-dashed',
40-
},
41-
selected: {
42-
false: '',
43-
true: '!border-solid !border-current',
44-
},
45-
type: {
46-
blank: 'bg-transparent text-gray-700',
47-
code: 'bg-pink-50 text-pink-700',
48-
hideTrashed: 'bg-transparent text-gray-700',
49-
image: 'bg-purple-50 text-purple-700',
50-
link: 'bg-blue-50 text-blue-700',
51-
open: 'bg-cyan-50 text-cyan-700',
52-
sent: 'bg-green-50 text-green-700',
53-
settings: 'bg-gray-50 text-gray-700',
54-
text: 'bg-gray-50 text-gray-700',
55-
time: 'bg-gray-50 text-gray-700',
56-
trashed: 'bg-gray-50 text-yellow-700',
57-
unsent: 'bg-amber-100 text-amber-700',
58-
},
59-
},
60-
},
61-
)
62-
63-
// Map types to their icons
64-
const typeIcons = {
65-
blank: Code,
66-
code: Code,
67-
hideTrashed: EyeOff,
68-
image: Image,
69-
link: Link,
70-
open: Monitor,
71-
sent: MailCheck,
72-
settings: Settings,
73-
text: TextSelect,
74-
time: Clock,
75-
trashed: Trash2,
76-
unsent: MessageSquareDashed,
77-
} as const
78-
7911
// StatBadge component
80-
type BadgeProps = VariantProps<typeof statBadge> & {
12+
export type BadgeProps = VariantProps<typeof statBadge> & {
8113
type: keyof typeof typeIcons
8214
text?: number | string
8315
}

0 commit comments

Comments
 (0)