Skip to content

Commit 1996298

Browse files
authored
feat: add shadcn ui config (#954)
* feat: add shadcn ui config * chore: tailwind config
1 parent c879c63 commit 1996298

8 files changed

Lines changed: 299 additions & 28 deletions

File tree

components.json

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

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
},
2020
"dependencies": {
2121
"@headlessui/react": "^2.2.2",
22+
"@radix-ui/react-slot": "^1.2.3",
2223
"@tauri-apps/api": "^2.5.0",
2324
"@tauri-apps/plugin-autostart": "~2.2.0",
2425
"@tauri-apps/plugin-deep-link": "^2.2.1",
@@ -35,6 +36,7 @@
3536
"@wavesurfer/react": "^1.0.11",
3637
"ahooks": "^3.8.4",
3738
"axios": "^1.12.0",
39+
"class-variance-authority": "^0.7.1",
3840
"clsx": "^2.1.1",
3941
"dayjs": "^1.11.13",
4042
"dotenv": "^16.5.0",
@@ -59,6 +61,7 @@
5961
"remark-gfm": "^4.0.1",
6062
"remark-math": "^6.0.0",
6163
"tailwind-merge": "^3.3.1",
64+
"tailwindcss-animate": "^1.0.7",
6265
"tauri-plugin-fs-pro-api": "^2.4.0",
6366
"tauri-plugin-macos-permissions-api": "^2.3.0",
6467
"tauri-plugin-screenshots-api": "^2.2.0",

pnpm-lock.yaml

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

src/components/ui/button.tsx

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
9+
{
10+
variants: {
11+
variant: {
12+
default:
13+
"bg-primary text-primary-foreground shadow hover:bg-primary/90",
14+
destructive:
15+
"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
16+
outline:
17+
"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
18+
secondary:
19+
"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
20+
ghost: "hover:bg-accent hover:text-accent-foreground",
21+
link: "text-primary underline-offset-4 hover:underline",
22+
},
23+
size: {
24+
default: "h-9 px-4 py-2",
25+
sm: "h-8 rounded-md px-3 text-xs",
26+
lg: "h-10 rounded-md px-8",
27+
icon: "h-9 w-9",
28+
},
29+
},
30+
defaultVariants: {
31+
variant: "default",
32+
size: "default",
33+
},
34+
}
35+
)
36+
37+
export interface ButtonProps
38+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
39+
VariantProps<typeof buttonVariants> {
40+
asChild?: boolean
41+
}
42+
43+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
44+
({ className, variant, size, asChild = false, ...props }, ref) => {
45+
const Comp = asChild ? Slot : "button"
46+
return (
47+
<Comp
48+
className={cn(buttonVariants({ variant, size, className }))}
49+
ref={ref}
50+
{...props}
51+
/>
52+
)
53+
}
54+
)
55+
Button.displayName = "Button"
56+
57+
export { Button, buttonVariants }

src/lib/utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { clsx, type ClassValue } from "clsx"
2+
import { twMerge } from "tailwind-merge"
3+
4+
export function cn(...inputs: ClassValue[]) {
5+
return twMerge(clsx(inputs))
6+
}

src/main.css

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,59 @@
106106
fill: currentColor;
107107
overflow: hidden;
108108
}
109+
:root {
110+
--background: 0 0% 100%;
111+
--foreground: 0 0% 3.9%;
112+
--card: 0 0% 100%;
113+
--card-foreground: 0 0% 3.9%;
114+
--popover: 0 0% 100%;
115+
--popover-foreground: 0 0% 3.9%;
116+
--primary: 0 0% 9%;
117+
--primary-foreground: 0 0% 98%;
118+
--secondary: 0 0% 96.1%;
119+
--secondary-foreground: 0 0% 9%;
120+
--muted: 0 0% 96.1%;
121+
--muted-foreground: 0 0% 45.1%;
122+
--accent: 0 0% 96.1%;
123+
--accent-foreground: 0 0% 9%;
124+
--destructive: 0 84.2% 60.2%;
125+
--destructive-foreground: 0 0% 98%;
126+
--border: 0 0% 89.8%;
127+
--input: 0 0% 89.8%;
128+
--ring: 0 0% 3.9%;
129+
--chart-1: 12 76% 61%;
130+
--chart-2: 173 58% 39%;
131+
--chart-3: 197 37% 24%;
132+
--chart-4: 43 74% 66%;
133+
--chart-5: 27 87% 67%;
134+
--radius: 0.5rem;
135+
}
136+
.dark {
137+
--background: 0 0% 3.9%;
138+
--foreground: 0 0% 98%;
139+
--card: 0 0% 3.9%;
140+
--card-foreground: 0 0% 98%;
141+
--popover: 0 0% 3.9%;
142+
--popover-foreground: 0 0% 98%;
143+
--primary: 0 0% 98%;
144+
--primary-foreground: 0 0% 9%;
145+
--secondary: 0 0% 14.9%;
146+
--secondary-foreground: 0 0% 98%;
147+
--muted: 0 0% 14.9%;
148+
--muted-foreground: 0 0% 63.9%;
149+
--accent: 0 0% 14.9%;
150+
--accent-foreground: 0 0% 98%;
151+
--destructive: 0 62.8% 30.6%;
152+
--destructive-foreground: 0 0% 98%;
153+
--border: 0 0% 14.9%;
154+
--input: 0 0% 14.9%;
155+
--ring: 0 0% 83.1%;
156+
--chart-1: 220 70% 50%;
157+
--chart-2: 160 60% 45%;
158+
--chart-3: 30 80% 55%;
159+
--chart-4: 280 65% 60%;
160+
--chart-5: 340 75% 55%;
161+
}
109162
}
110163

111164
/* Component styles */
@@ -261,3 +314,12 @@
261314
display: none; /* Chrome/Safari */
262315
}
263316
}
317+
318+
@layer base {
319+
* {
320+
@apply border-border;
321+
}
322+
body {
323+
@apply bg-background text-foreground;
324+
}
325+
}

src/pages/main/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ function MainApp() {
3535
<>
3636
<SearchChat isTauri={true} hasModules={["search", "chat"]} />
3737
<UpdateApp />
38-
3938
{synthesizeItem && <Synthesize />}
4039
</>
4140
);

0 commit comments

Comments
 (0)