Skip to content

Commit 6cafce3

Browse files
committed
chore: add shadcn ui
1 parent c9debd7 commit 6cafce3

File tree

9 files changed

+1196
-323
lines changed

9 files changed

+1196
-323
lines changed

apps/react-app/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": "",
8+
"css": "src/index.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+
}

apps/react-app/package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13+
"@radix-ui/react-slot": "^1.2.4",
14+
"class-variance-authority": "^0.7.1",
15+
"clsx": "^2.1.1",
16+
"lucide-react": "^0.554.0",
1317
"react": "^19.2.0",
14-
"react-dom": "^19.2.0"
18+
"react-dom": "^19.2.0",
19+
"tailwind-merge": "^3.4.0"
1520
},
1621
"devDependencies": {
1722
"@eslint/js": "^9.39.1",
23+
"@tailwindcss/vite": "^4.1.17",
1824
"@types/node": "^24.10.1",
1925
"@types/react": "^19.2.5",
2026
"@types/react-dom": "^19.2.3",
@@ -24,6 +30,8 @@
2430
"eslint-plugin-react-hooks": "^7.0.1",
2531
"eslint-plugin-react-refresh": "^0.4.24",
2632
"globals": "^16.5.0",
33+
"tailwindcss": "^4.1.17",
34+
"tw-animate-css": "^1.4.0",
2735
"typescript": "~5.9.3",
2836
"typescript-eslint": "^8.46.4",
2937
"vite": "^7.2.4"
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
9+
{
10+
variants: {
11+
variant: {
12+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
13+
destructive:
14+
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
15+
outline:
16+
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
17+
secondary:
18+
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
19+
ghost:
20+
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
21+
link: "text-primary underline-offset-4 hover:underline",
22+
},
23+
size: {
24+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
25+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
26+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
27+
icon: "size-9",
28+
"icon-sm": "size-8",
29+
"icon-lg": "size-10",
30+
},
31+
},
32+
defaultVariants: {
33+
variant: "default",
34+
size: "default",
35+
},
36+
}
37+
)
38+
39+
function Button({
40+
className,
41+
variant,
42+
size,
43+
asChild = false,
44+
...props
45+
}: React.ComponentProps<"button"> &
46+
VariantProps<typeof buttonVariants> & {
47+
asChild?: boolean
48+
}) {
49+
const Comp = asChild ? Slot : "button"
50+
51+
return (
52+
<Comp
53+
data-slot="button"
54+
className={cn(buttonVariants({ variant, size, className }))}
55+
{...props}
56+
/>
57+
)
58+
}
59+
60+
export { Button, buttonVariants }

apps/react-app/src/index.css

Lines changed: 110 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,120 @@
1-
:root {
2-
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
3-
font-weight: 400;
4-
font-synthesis: none;
5-
line-height: 1.5;
6-
color: rgb(255 255 255 / 87%);
7-
color-scheme: light dark;
8-
background-color: #242424;
9-
text-rendering: optimizelegibility;
10-
-webkit-font-smoothing: antialiased;
11-
-moz-osx-font-smoothing: grayscale;
12-
}
13-
14-
a {
15-
font-weight: 500;
16-
color: #646cff;
17-
text-decoration: inherit;
18-
}
19-
20-
a:hover {
21-
color: #535bf2;
22-
}
23-
24-
body {
25-
display: flex;
26-
place-items: center;
27-
min-width: 320px;
28-
min-height: 100vh;
29-
margin: 0;
30-
}
31-
32-
h1 {
33-
font-size: 3.2em;
34-
line-height: 1.1;
35-
}
1+
@import "tailwindcss";
2+
@import "tw-animate-css";
3+
@custom-variant dark (&:is(.dark *));
364

37-
button {
38-
padding: 0.6em 1.2em;
39-
font-family: inherit;
40-
font-size: 1em;
41-
font-weight: 500;
42-
cursor: pointer;
43-
background-color: #1a1a1a;
44-
border: 1px solid transparent;
45-
border-radius: 8px;
46-
transition: border-color 0.25s;
5+
@theme inline {
6+
--radius-sm: calc(var(--radius) - 4px);
7+
--radius-md: calc(var(--radius) - 2px);
8+
--radius-lg: var(--radius);
9+
--radius-xl: calc(var(--radius) + 4px);
10+
--color-background: var(--background);
11+
--color-foreground: var(--foreground);
12+
--color-card: var(--card);
13+
--color-card-foreground: var(--card-foreground);
14+
--color-popover: var(--popover);
15+
--color-popover-foreground: var(--popover-foreground);
16+
--color-primary: var(--primary);
17+
--color-primary-foreground: var(--primary-foreground);
18+
--color-secondary: var(--secondary);
19+
--color-secondary-foreground: var(--secondary-foreground);
20+
--color-muted: var(--muted);
21+
--color-muted-foreground: var(--muted-foreground);
22+
--color-accent: var(--accent);
23+
--color-accent-foreground: var(--accent-foreground);
24+
--color-destructive: var(--destructive);
25+
--color-border: var(--border);
26+
--color-input: var(--input);
27+
--color-ring: var(--ring);
28+
--color-chart-1: var(--chart-1);
29+
--color-chart-2: var(--chart-2);
30+
--color-chart-3: var(--chart-3);
31+
--color-chart-4: var(--chart-4);
32+
--color-chart-5: var(--chart-5);
33+
--color-sidebar: var(--sidebar);
34+
--color-sidebar-foreground: var(--sidebar-foreground);
35+
--color-sidebar-primary: var(--sidebar-primary);
36+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
37+
--color-sidebar-accent: var(--sidebar-accent);
38+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
39+
--color-sidebar-border: var(--sidebar-border);
40+
--color-sidebar-ring: var(--sidebar-ring);
4741
}
4842

49-
button:hover {
50-
border-color: #646cff;
43+
:root {
44+
--radius: 0.625rem;
45+
--background: oklch(100% 0 0deg);
46+
--foreground: oklch(14.5% 0 0deg);
47+
--card: oklch(100% 0 0deg);
48+
--card-foreground: oklch(14.5% 0 0deg);
49+
--popover: oklch(100% 0 0deg);
50+
--popover-foreground: oklch(14.5% 0 0deg);
51+
--primary: oklch(20.5% 0 0deg);
52+
--primary-foreground: oklch(98.5% 0 0deg);
53+
--secondary: oklch(97% 0 0deg);
54+
--secondary-foreground: oklch(20.5% 0 0deg);
55+
--muted: oklch(97% 0 0deg);
56+
--muted-foreground: oklch(55.6% 0 0deg);
57+
--accent: oklch(97% 0 0deg);
58+
--accent-foreground: oklch(20.5% 0 0deg);
59+
--destructive: oklch(57.7% 0.245 27.325deg);
60+
--border: oklch(92.2% 0 0deg);
61+
--input: oklch(92.2% 0 0deg);
62+
--ring: oklch(70.8% 0 0deg);
63+
--chart-1: oklch(64.6% 0.222 41.116deg);
64+
--chart-2: oklch(60% 0.118 184.704deg);
65+
--chart-3: oklch(39.8% 0.07 227.392deg);
66+
--chart-4: oklch(82.8% 0.189 84.429deg);
67+
--chart-5: oklch(76.9% 0.188 70.08deg);
68+
--sidebar: oklch(98.5% 0 0deg);
69+
--sidebar-foreground: oklch(14.5% 0 0deg);
70+
--sidebar-primary: oklch(20.5% 0 0deg);
71+
--sidebar-primary-foreground: oklch(98.5% 0 0deg);
72+
--sidebar-accent: oklch(97% 0 0deg);
73+
--sidebar-accent-foreground: oklch(20.5% 0 0deg);
74+
--sidebar-border: oklch(92.2% 0 0deg);
75+
--sidebar-ring: oklch(70.8% 0 0deg);
5176
}
5277

53-
button:focus,
54-
button:focus-visible {
55-
outline: 4px auto -webkit-focus-ring-color;
78+
.dark {
79+
--background: oklch(14.5% 0 0deg);
80+
--foreground: oklch(98.5% 0 0deg);
81+
--card: oklch(20.5% 0 0deg);
82+
--card-foreground: oklch(98.5% 0 0deg);
83+
--popover: oklch(20.5% 0 0deg);
84+
--popover-foreground: oklch(98.5% 0 0deg);
85+
--primary: oklch(92.2% 0 0deg);
86+
--primary-foreground: oklch(20.5% 0 0deg);
87+
--secondary: oklch(26.9% 0 0deg);
88+
--secondary-foreground: oklch(98.5% 0 0deg);
89+
--muted: oklch(26.9% 0 0deg);
90+
--muted-foreground: oklch(70.8% 0 0deg);
91+
--accent: oklch(26.9% 0 0deg);
92+
--accent-foreground: oklch(98.5% 0 0deg);
93+
--destructive: oklch(70.4% 0.191 22.216deg);
94+
--border: oklch(100% 0 0deg / 10%);
95+
--input: oklch(100% 0 0deg / 15%);
96+
--ring: oklch(55.6% 0 0deg);
97+
--chart-1: oklch(48.8% 0.243 264.376deg);
98+
--chart-2: oklch(69.6% 0.17 162.48deg);
99+
--chart-3: oklch(76.9% 0.188 70.08deg);
100+
--chart-4: oklch(62.7% 0.265 303.9deg);
101+
--chart-5: oklch(64.5% 0.246 16.439deg);
102+
--sidebar: oklch(20.5% 0 0deg);
103+
--sidebar-foreground: oklch(98.5% 0 0deg);
104+
--sidebar-primary: oklch(48.8% 0.243 264.376deg);
105+
--sidebar-primary-foreground: oklch(98.5% 0 0deg);
106+
--sidebar-accent: oklch(26.9% 0 0deg);
107+
--sidebar-accent-foreground: oklch(98.5% 0 0deg);
108+
--sidebar-border: oklch(100% 0 0deg / 10%);
109+
--sidebar-ring: oklch(55.6% 0 0deg);
56110
}
57111

58-
@media (prefers-color-scheme: light) {
59-
:root {
60-
color: #213547;
61-
background-color: #fff;
112+
@layer base {
113+
* {
114+
@apply border-border outline-ring/50;
62115
}
63116

64-
a:hover {
65-
color: #747bff;
117+
body {
118+
@apply bg-background text-foreground;
66119
}
67-
68-
button {
69-
background-color: #f9f9f9;
70-
}
71-
}
120+
}

apps/react-app/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+
}

apps/react-app/tsconfig.app.json

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,38 @@
33
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
44
"target": "ES2022",
55
"useDefineForClassFields": true,
6-
"lib": ["ES2022", "DOM", "DOM.Iterable"],
6+
"lib": [
7+
"ES2022",
8+
"DOM",
9+
"DOM.Iterable"
10+
],
711
"module": "ESNext",
8-
"types": ["vite/client"],
12+
"types": [
13+
"vite/client"
14+
],
915
"skipLibCheck": true,
10-
1116
/* Bundler mode */
1217
"moduleResolution": "bundler",
1318
"allowImportingTsExtensions": true,
1419
"verbatimModuleSyntax": true,
1520
"moduleDetection": "force",
1621
"noEmit": true,
1722
"jsx": "react-jsx",
18-
1923
/* Linting */
2024
"strict": true,
2125
"noUnusedLocals": true,
2226
"noUnusedParameters": true,
2327
"erasableSyntaxOnly": true,
2428
"noFallthroughCasesInSwitch": true,
25-
"noUncheckedSideEffectImports": true
29+
"noUncheckedSideEffectImports": true,
30+
"baseUrl": ".",
31+
"paths": {
32+
"@/*": [
33+
"./src/*"
34+
]
35+
}
2636
},
27-
"include": ["src"]
28-
}
37+
"include": [
38+
"src"
39+
]
40+
}

apps/react-app/tsconfig.json

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
{
22
"files": [],
33
"references": [
4-
{ "path": "./tsconfig.app.json" },
5-
{ "path": "./tsconfig.node.json" }
6-
]
7-
}
4+
{
5+
"path": "./tsconfig.app.json"
6+
},
7+
{
8+
"path": "./tsconfig.node.json"
9+
}
10+
],
11+
"compilerOptions": {
12+
"baseUrl": ".",
13+
"paths": {
14+
"@/*": [
15+
"./src/*"
16+
]
17+
}
18+
}
19+
}

apps/react-app/vite.config.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { defineConfig } from 'vite'
22
import react from '@vitejs/plugin-react'
3-
3+
import path from "path"
4+
import tailwindcss from "@tailwindcss/vite"
45
// https://vite.dev/config/
56
export default defineConfig({
67
plugins: [
@@ -9,5 +10,11 @@ export default defineConfig({
910
plugins: [['babel-plugin-react-compiler']],
1011
},
1112
}),
13+
tailwindcss()
1214
],
15+
resolve: {
16+
alias: {
17+
"@": path.resolve(__dirname, "./src"),
18+
},
19+
},
1320
})

0 commit comments

Comments
 (0)