Skip to content

Commit d750d0f

Browse files
committed
feat: added shadcn components
1 parent fc41089 commit d750d0f

17 files changed

Lines changed: 1264 additions & 6 deletions

File tree

apps/origami-web/package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,18 @@
1111
"postinstall": "fumadocs-mdx"
1212
},
1313
"dependencies": {
14+
"@hookform/resolvers": "^5.1.1",
15+
"@radix-ui/react-avatar": "^1.1.10",
16+
"@radix-ui/react-checkbox": "^1.3.2",
17+
"@radix-ui/react-dialog": "^1.1.14",
1418
"@radix-ui/react-dropdown-menu": "^2.1.15",
19+
"@radix-ui/react-label": "^2.1.7",
20+
"@radix-ui/react-radio-group": "^1.3.7",
21+
"@radix-ui/react-select": "^2.2.5",
1522
"@radix-ui/react-slot": "^1.2.3",
23+
"@radix-ui/react-switch": "^1.2.5",
24+
"@radix-ui/react-toggle": "^1.1.9",
25+
"@radix-ui/react-toggle-group": "^1.1.10",
1626
"@radix-ui/react-tooltip": "^1.2.7",
1727
"@repo/database": "workspace:*",
1828
"@repo/location": "workspace:*",
@@ -37,11 +47,12 @@
3747
"nuqs": "^2.4.3",
3848
"react": "^19.0.0",
3949
"react-dom": "^19.0.0",
50+
"react-hook-form": "^7.58.0",
4051
"sonner": "^2.0.5",
4152
"superjson": "^2.2.2",
4253
"tailwind-merge": "^3.3.0",
4354
"tw-animate-css": "^1.3.0",
44-
"zod": "^3.24.4",
55+
"zod": "^3.25.56",
4556
"zustand": "^5.0.5"
4657
},
4758
"devDependencies": {
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
import Icon from "@/components/ui/icons";
2+
13
export default function Page() {
2-
return <div>Page</div>;
4+
return (
5+
<div>
6+
Page
7+
<Icon name="sidebar" variant="filled" />
8+
</div>
9+
);
310
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
"use client"
2+
3+
import * as React from "react"
4+
import * as AvatarPrimitive from "@radix-ui/react-avatar"
5+
6+
import { cn } from "@/lib/utils"
7+
8+
function Avatar({
9+
className,
10+
...props
11+
}: React.ComponentProps<typeof AvatarPrimitive.Root>) {
12+
return (
13+
<AvatarPrimitive.Root
14+
data-slot="avatar"
15+
className={cn(
16+
"relative flex size-8 shrink-0 overflow-hidden rounded-full",
17+
className
18+
)}
19+
{...props}
20+
/>
21+
)
22+
}
23+
24+
function AvatarImage({
25+
className,
26+
...props
27+
}: React.ComponentProps<typeof AvatarPrimitive.Image>) {
28+
return (
29+
<AvatarPrimitive.Image
30+
data-slot="avatar-image"
31+
className={cn("aspect-square size-full", className)}
32+
{...props}
33+
/>
34+
)
35+
}
36+
37+
function AvatarFallback({
38+
className,
39+
...props
40+
}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
41+
return (
42+
<AvatarPrimitive.Fallback
43+
data-slot="avatar-fallback"
44+
className={cn(
45+
"bg-muted flex size-full items-center justify-center rounded-full",
46+
className
47+
)}
48+
{...props}
49+
/>
50+
)
51+
}
52+
53+
export { Avatar, AvatarImage, AvatarFallback }
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"use client"
2+
3+
import * as React from "react"
4+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
5+
import { CheckIcon } from "lucide-react"
6+
7+
import { cn } from "@/lib/utils"
8+
9+
function Checkbox({
10+
className,
11+
...props
12+
}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
13+
return (
14+
<CheckboxPrimitive.Root
15+
data-slot="checkbox"
16+
className={cn(
17+
"peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
18+
className
19+
)}
20+
{...props}
21+
>
22+
<CheckboxPrimitive.Indicator
23+
data-slot="checkbox-indicator"
24+
className="flex items-center justify-center text-current transition-none"
25+
>
26+
<CheckIcon className="size-3.5" />
27+
</CheckboxPrimitive.Indicator>
28+
</CheckboxPrimitive.Root>
29+
)
30+
}
31+
32+
export { Checkbox }
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
"use client"
2+
3+
import * as React from "react"
4+
import * as DialogPrimitive from "@radix-ui/react-dialog"
5+
import { XIcon } from "lucide-react"
6+
7+
import { cn } from "@/lib/utils"
8+
9+
function Dialog({
10+
...props
11+
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
12+
return <DialogPrimitive.Root data-slot="dialog" {...props} />
13+
}
14+
15+
function DialogTrigger({
16+
...props
17+
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
18+
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
19+
}
20+
21+
function DialogPortal({
22+
...props
23+
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
24+
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
25+
}
26+
27+
function DialogClose({
28+
...props
29+
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
30+
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
31+
}
32+
33+
function DialogOverlay({
34+
className,
35+
...props
36+
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
37+
return (
38+
<DialogPrimitive.Overlay
39+
data-slot="dialog-overlay"
40+
className={cn(
41+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
42+
className
43+
)}
44+
{...props}
45+
/>
46+
)
47+
}
48+
49+
function DialogContent({
50+
className,
51+
children,
52+
showCloseButton = true,
53+
...props
54+
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
55+
showCloseButton?: boolean
56+
}) {
57+
return (
58+
<DialogPortal data-slot="dialog-portal">
59+
<DialogOverlay />
60+
<DialogPrimitive.Content
61+
data-slot="dialog-content"
62+
className={cn(
63+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
64+
className
65+
)}
66+
{...props}
67+
>
68+
{children}
69+
{showCloseButton && (
70+
<DialogPrimitive.Close
71+
data-slot="dialog-close"
72+
className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
73+
>
74+
<XIcon />
75+
<span className="sr-only">Close</span>
76+
</DialogPrimitive.Close>
77+
)}
78+
</DialogPrimitive.Content>
79+
</DialogPortal>
80+
)
81+
}
82+
83+
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
84+
return (
85+
<div
86+
data-slot="dialog-header"
87+
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
88+
{...props}
89+
/>
90+
)
91+
}
92+
93+
function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
94+
return (
95+
<div
96+
data-slot="dialog-footer"
97+
className={cn(
98+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
99+
className
100+
)}
101+
{...props}
102+
/>
103+
)
104+
}
105+
106+
function DialogTitle({
107+
className,
108+
...props
109+
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
110+
return (
111+
<DialogPrimitive.Title
112+
data-slot="dialog-title"
113+
className={cn("text-lg leading-none font-semibold", className)}
114+
{...props}
115+
/>
116+
)
117+
}
118+
119+
function DialogDescription({
120+
className,
121+
...props
122+
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
123+
return (
124+
<DialogPrimitive.Description
125+
data-slot="dialog-description"
126+
className={cn("text-muted-foreground text-sm", className)}
127+
{...props}
128+
/>
129+
)
130+
}
131+
132+
export {
133+
Dialog,
134+
DialogClose,
135+
DialogContent,
136+
DialogDescription,
137+
DialogFooter,
138+
DialogHeader,
139+
DialogOverlay,
140+
DialogPortal,
141+
DialogTitle,
142+
DialogTrigger,
143+
}

0 commit comments

Comments
 (0)