Skip to content

Commit f4c2d3e

Browse files
authored
chore: add shadcn configuration and btn component (#33)
* chore: add shadcn configuration and btn component * leftover
1 parent 5f943ff commit f4c2d3e

File tree

6 files changed

+177
-13
lines changed

6 files changed

+177
-13
lines changed

components.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "new-york",
4+
"rsc": true,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "",
8+
"css": "src/app/globals.css",
9+
"baseColor": "zinc",
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+
}

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717
},
1818
"dependencies": {
1919
"better-auth": "1.4.0-beta.21",
20+
"class-variance-authority": "0.7.1",
21+
"clsx": "2.1.1",
2022
"next": "16.0.3",
2123
"react": "19.2.0",
22-
"react-dom": "19.2.0"
24+
"react-dom": "19.2.0",
25+
"tailwind-merge": "3.4.0"
2326
},
2427
"devDependencies": {
2528
"@biomejs/biome": "2.3.5",

pnpm-lock.yaml

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

src/app/globals.css

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,80 @@
11
@import "tailwindcss";
22

33
:root {
4-
--background: #ffffff;
5-
--foreground: #171717;
4+
--background: 0 0% 100%;
5+
--foreground: 240 10% 3.9%;
6+
--card: 0 0% 100%;
7+
--card-foreground: 240 10% 3.9%;
8+
--popover: 0 0% 100%;
9+
--popover-foreground: 240 10% 3.9%;
10+
--primary: 240 5.9% 10%;
11+
--primary-foreground: 0 0% 98%;
12+
--secondary: 240 4.8% 95.9%;
13+
--secondary-foreground: 240 5.9% 10%;
14+
--muted: 240 4.8% 95.9%;
15+
--muted-foreground: 240 3.8% 46.1%;
16+
--accent: 240 4.8% 95.9%;
17+
--accent-foreground: 240 5.9% 10%;
18+
--destructive: 0 84.2% 60.2%;
19+
--destructive-foreground: 0 0% 98%;
20+
--border: 240 5.9% 90%;
21+
--input: 240 5.9% 90%;
22+
--ring: 240 5.9% 10%;
23+
--radius: 0.5rem;
24+
}
25+
26+
.dark {
27+
--background: 240 10% 3.9%;
28+
--foreground: 0 0% 98%;
29+
--card: 240 10% 3.9%;
30+
--card-foreground: 0 0% 98%;
31+
--popover: 240 10% 3.9%;
32+
--popover-foreground: 0 0% 98%;
33+
--primary: 0 0% 98%;
34+
--primary-foreground: 240 5.9% 10%;
35+
--secondary: 240 3.7% 15.9%;
36+
--secondary-foreground: 0 0% 98%;
37+
--muted: 240 3.7% 15.9%;
38+
--muted-foreground: 240 5% 64.9%;
39+
--accent: 240 3.7% 15.9%;
40+
--accent-foreground: 0 0% 98%;
41+
--destructive: 0 62.8% 30.6%;
42+
--destructive-foreground: 0 0% 98%;
43+
--border: 240 3.7% 15.9%;
44+
--input: 240 3.7% 15.9%;
45+
--ring: 240 4.9% 83.9%;
646
}
747

848
@theme inline {
9-
--color-background: var(--background);
10-
--color-foreground: var(--foreground);
1149
--font-sans: var(--font-geist-sans);
1250
--font-mono: var(--font-geist-mono);
51+
52+
--color-background: hsl(var(--background));
53+
--color-foreground: hsl(var(--foreground));
54+
--color-card: hsl(var(--card));
55+
--color-card-foreground: hsl(var(--card-foreground));
56+
--color-popover: hsl(var(--popover));
57+
--color-popover-foreground: hsl(var(--popover-foreground));
58+
--color-primary: hsl(var(--primary));
59+
--color-primary-foreground: hsl(var(--primary-foreground));
60+
--color-secondary: hsl(var(--secondary));
61+
--color-secondary-foreground: hsl(var(--secondary-foreground));
62+
--color-muted: hsl(var(--muted));
63+
--color-muted-foreground: hsl(var(--muted-foreground));
64+
--color-accent: hsl(var(--accent));
65+
--color-accent-foreground: hsl(var(--accent-foreground));
66+
--color-destructive: hsl(var(--destructive));
67+
--color-destructive-foreground: hsl(var(--destructive-foreground));
68+
--color-border: hsl(var(--border));
69+
--color-input: hsl(var(--input));
70+
--color-ring: hsl(var(--ring));
1371
}
1472

15-
@media (prefers-color-scheme: dark) {
16-
:root {
17-
--background: #0a0a0a;
18-
--foreground: #ededed;
19-
}
73+
* {
74+
border-color: hsl(var(--border));
2075
}
2176

2277
body {
23-
background: var(--background);
24-
color: var(--foreground);
25-
font-family: Arial, Helvetica, sans-serif;
78+
background: hsl(var(--background));
79+
color: hsl(var(--foreground));
2680
}

src/components/ui/button.tsx

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { cva, type VariantProps } from "class-variance-authority";
2+
import * as React from "react";
3+
4+
import { cn } from "@/lib/utils";
5+
6+
const buttonVariants = cva(
7+
"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",
8+
{
9+
variants: {
10+
variant: {
11+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
12+
destructive:
13+
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
14+
outline:
15+
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
16+
secondary:
17+
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
18+
ghost: "hover:bg-accent hover:text-accent-foreground",
19+
link: "text-primary underline-offset-4 hover:underline",
20+
},
21+
size: {
22+
default: "h-10 px-4 py-2",
23+
sm: "h-9 rounded-md px-3",
24+
lg: "h-11 rounded-md px-8",
25+
icon: "h-10 w-10",
26+
},
27+
},
28+
defaultVariants: {
29+
variant: "default",
30+
size: "default",
31+
},
32+
},
33+
);
34+
35+
export interface ButtonProps
36+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
37+
VariantProps<typeof buttonVariants> {
38+
asChild?: boolean;
39+
}
40+
41+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
42+
({ className, variant, size, asChild = false, ...props }, ref) => {
43+
return (
44+
<button
45+
className={cn(buttonVariants({ variant, size, className }))}
46+
ref={ref}
47+
{...props}
48+
/>
49+
);
50+
},
51+
);
52+
Button.displayName = "Button";
53+
54+
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 { type ClassValue, clsx } 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)