Skip to content

Commit 49bc9b3

Browse files
committed
Propery initialize shadcn/ui
1 parent 4ea95c0 commit 49bc9b3

File tree

7 files changed

+188
-7
lines changed

7 files changed

+188
-7
lines changed

browser-extension/components.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "default",
4+
"rsc": false,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "tailwind.config.js",
8+
"css": "src/styles/globals.css",
9+
"baseColor": "slate",
10+
"cssVariables": true,
11+
"prefix": ""
12+
},
13+
"aliases": {
14+
"components": "@/components",
15+
"utils": "@/lib/utils",
16+
"ui": "@/components/ui",
17+
"lib": "@/lib",
18+
"hooks": "@/hooks"
19+
},
20+
"iconLibrary": "lucide"
21+
}

browser-extension/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"author": "DiffPlug",
33
"dependencies": {
4+
"@radix-ui/react-slot": "^1.2.3",
45
"@types/react": "^19.1.12",
56
"@types/react-dom": "^19.1.9",
67
"@wxt-dev/webextension-polyfill": "^1.0.0",
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import * as React from "react"
2+
import { Slot } from "@radix-ui/react-slot"
3+
import { cva, type VariantProps } from "class-variance-authority"
4+
5+
import { cn } from "@/lib/utils"
6+
7+
const buttonVariants = cva(
8+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
9+
{
10+
variants: {
11+
variant: {
12+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
13+
destructive:
14+
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
15+
outline:
16+
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
17+
secondary:
18+
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
19+
ghost: "hover:bg-accent hover:text-accent-foreground",
20+
link: "text-primary underline-offset-4 hover:underline",
21+
},
22+
size: {
23+
default: "h-10 px-4 py-2",
24+
sm: "h-9 rounded-md px-3",
25+
lg: "h-11 rounded-md px-8",
26+
icon: "h-10 w-10",
27+
},
28+
},
29+
defaultVariants: {
30+
variant: "default",
31+
size: "default",
32+
},
33+
}
34+
)
35+
36+
export interface ButtonProps
37+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
38+
VariantProps<typeof buttonVariants> {
39+
asChild?: boolean
40+
}
41+
42+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
43+
({ className, variant, size, asChild = false, ...props }, ref) => {
44+
const Comp = asChild ? Slot : "button"
45+
return (
46+
<Comp
47+
className={cn(buttonVariants({ variant, size, className }))}
48+
ref={ref}
49+
{...props}
50+
/>
51+
)
52+
}
53+
)
54+
Button.displayName = "Button"
55+
56+
export { Button, buttonVariants }

browser-extension/src/entrypoints/background.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import type { CommentDraft, CommentEvent, CommentSpot } from '../lib/enhancer'
2-
import type { GetOpenSpotsResponse, ToBackgroundMessage } from '../lib/messages'
1+
import type { CommentDraft, CommentEvent, CommentSpot } from '@/lib/enhancer'
2+
import type { GetOpenSpotsResponse, ToBackgroundMessage } from '@/lib/messages'
33
import {
44
CLOSE_MESSAGE_PORT,
55
isContentToBackgroundMessage,
66
isGetOpenSpotsMessage,
77
isSwitchToTabMessage,
88
KEEP_PORT_OPEN,
9-
} from '../lib/messages'
9+
} from '@/lib/messages'
1010

1111
export interface Tab {
1212
tabId: number

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ import {
1010
TableRow,
1111
} from '@/components/ui/table'
1212
import { cn } from '@/lib/utils'
13-
import { logger } from '../../lib/logger'
13+
import { logger } from '@/lib/logger'
1414
import type {
1515
GetOpenSpotsMessage,
1616
GetOpenSpotsResponse,
1717
SwitchToTabMessage,
18-
} from '../../lib/messages'
19-
import { EnhancerRegistry } from '../../lib/registries'
20-
import type { CommentState } from '../background'
18+
} from '@/lib/messages'
19+
import { EnhancerRegistry } from '@/lib/registries'
20+
import type { CommentState } from '@/entrypoints/background'
2121

2222
const enhancers = new EnhancerRegistry()
2323

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
5+
@layer base {
6+
:root {
7+
--background: 0 0% 100%;
8+
--foreground: 222.2 84% 4.9%;
9+
--card: 0 0% 100%;
10+
--card-foreground: 222.2 84% 4.9%;
11+
--popover: 0 0% 100%;
12+
--popover-foreground: 222.2 84% 4.9%;
13+
--primary: 222.2 47.4% 11.2%;
14+
--primary-foreground: 210 40% 98%;
15+
--secondary: 210 40% 96%;
16+
--secondary-foreground: 222.2 47.4% 11.2%;
17+
--muted: 210 40% 96%;
18+
--muted-foreground: 215.4 16.3% 46.9%;
19+
--accent: 210 40% 96%;
20+
--accent-foreground: 222.2 47.4% 11.2%;
21+
--destructive: 0 84.2% 60.2%;
22+
--destructive-foreground: 210 40% 98%;
23+
--border: 214.3 31.8% 91.4%;
24+
--input: 214.3 31.8% 91.4%;
25+
--ring: 222.2 84% 4.9%;
26+
--chart-1: 12 76% 61%;
27+
--chart-2: 173 58% 39%;
28+
--chart-3: 197 37% 24%;
29+
--chart-4: 43 74% 66%;
30+
--chart-5: 27 87% 67%;
31+
--radius: 0.5rem;
32+
}
33+
34+
.dark {
35+
--background: 222.2 84% 4.9%;
36+
--foreground: 210 40% 98%;
37+
--card: 222.2 84% 4.9%;
38+
--card-foreground: 210 40% 98%;
39+
--popover: 222.2 84% 4.9%;
40+
--popover-foreground: 210 40% 98%;
41+
--primary: 210 40% 98%;
42+
--primary-foreground: 222.2 47.4% 11.2%;
43+
--secondary: 217.2 32.6% 17.5%;
44+
--secondary-foreground: 210 40% 98%;
45+
--muted: 217.2 32.6% 17.5%;
46+
--muted-foreground: 215 20.2% 65.1%;
47+
--accent: 217.2 32.6% 17.5%;
48+
--accent-foreground: 210 40% 98%;
49+
--destructive: 0 62.8% 30.6%;
50+
--destructive-foreground: 210 40% 98%;
51+
--border: 217.2 32.6% 17.5%;
52+
--input: 217.2 32.6% 17.5%;
53+
--ring: 212.7 26.8% 83.9%;
54+
--chart-1: 220 70% 50%;
55+
--chart-2: 160 60% 45%;
56+
--chart-3: 30 80% 55%;
57+
--chart-4: 280 65% 60%;
58+
--chart-5: 340 75% 55%;
59+
}
60+
}
61+
62+
@layer base {
63+
* {
64+
@apply border-border;
65+
}
66+
body {
67+
@apply bg-background text-foreground;
68+
}
69+
}

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)