Skip to content

Commit 9262f7a

Browse files
committed
shadcn
1 parent 179e534 commit 9262f7a

File tree

7 files changed

+327
-158
lines changed

7 files changed

+327
-158
lines changed

app/globals.css

Lines changed: 65 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,75 @@
22
@tailwind components;
33
@tailwind utilities;
44

5-
:root {
6-
--background: #ffffff;
7-
--foreground: #171717;
5+
body {
6+
font-family: system-ui, sans-serif;
87
}
98

10-
@media (prefers-color-scheme: dark) {
9+
10+
11+
@layer base {
1112
:root {
12-
--background: #0a0a0a;
13-
--foreground: #ededed;
13+
--background: 0 0% 100%;
14+
--foreground: 0 0% 3.9%;
15+
--card: 0 0% 100%;
16+
--card-foreground: 0 0% 3.9%;
17+
--popover: 0 0% 100%;
18+
--popover-foreground: 0 0% 3.9%;
19+
--primary: 0 0% 9%;
20+
--primary-foreground: 0 0% 98%;
21+
--secondary: 0 0% 96.1%;
22+
--secondary-foreground: 0 0% 9%;
23+
--muted: 0 0% 96.1%;
24+
--muted-foreground: 0 0% 45.1%;
25+
--accent: 0 0% 96.1%;
26+
--accent-foreground: 0 0% 9%;
27+
--destructive: 0 84.2% 60.2%;
28+
--destructive-foreground: 0 0% 98%;
29+
--border: 0 0% 89.8%;
30+
--input: 0 0% 89.8%;
31+
--ring: 0 0% 3.9%;
32+
--chart-1: 12 76% 61%;
33+
--chart-2: 173 58% 39%;
34+
--chart-3: 197 37% 24%;
35+
--chart-4: 43 74% 66%;
36+
--chart-5: 27 87% 67%;
37+
--radius: 0.5rem;
38+
}
39+
.dark {
40+
--background: 0 0% 3.9%;
41+
--foreground: 0 0% 98%;
42+
--card: 0 0% 3.9%;
43+
--card-foreground: 0 0% 98%;
44+
--popover: 0 0% 3.9%;
45+
--popover-foreground: 0 0% 98%;
46+
--primary: 0 0% 98%;
47+
--primary-foreground: 0 0% 9%;
48+
--secondary: 0 0% 14.9%;
49+
--secondary-foreground: 0 0% 98%;
50+
--muted: 0 0% 14.9%;
51+
--muted-foreground: 0 0% 63.9%;
52+
--accent: 0 0% 14.9%;
53+
--accent-foreground: 0 0% 98%;
54+
--destructive: 0 62.8% 30.6%;
55+
--destructive-foreground: 0 0% 98%;
56+
--border: 0 0% 14.9%;
57+
--input: 0 0% 14.9%;
58+
--ring: 0 0% 83.1%;
59+
--chart-1: 220 70% 50%;
60+
--chart-2: 160 60% 45%;
61+
--chart-3: 30 80% 55%;
62+
--chart-4: 280 65% 60%;
63+
--chart-5: 340 75% 55%;
1464
}
1565
}
1666

17-
body {
18-
background: var(--background);
19-
color: var(--foreground);
20-
font-family: system-ui, sans-serif;
67+
68+
69+
@layer base {
70+
* {
71+
@apply border-border;
72+
}
73+
body {
74+
@apply bg-background text-foreground;
75+
}
2176
}

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": true,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "tailwind.config.js",
8+
"css": "app/globals.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+
}

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 }

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+
}

0 commit comments

Comments
 (0)