|
1 | | -'use client'; |
2 | | -import * as DialogPrimitive from '@radix-ui/react-dialog'; |
3 | | -import * as React from 'react'; |
| 1 | +"use client"; |
4 | 2 | // import { X } from 'lucide-react'; |
5 | | -import { cn } from '@/lib/utils'; |
| 3 | +import { cn } from "@/lib/utils"; |
| 4 | +import * as DialogPrimitive from "@radix-ui/react-dialog"; |
| 5 | +import * as React from "react"; |
6 | 6 | const Dialog = DialogPrimitive.Root; |
7 | 7 | const DialogTrigger = DialogPrimitive.Trigger; |
8 | 8 | const DialogPortal = DialogPrimitive.Portal; |
9 | 9 | const DialogClose = DialogPrimitive.Close; |
10 | 10 | const DialogOverlay = React.forwardRef< |
11 | | - React.ElementRef<typeof DialogPrimitive.Overlay>, |
12 | | - React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> |
| 11 | + React.ElementRef<typeof DialogPrimitive.Overlay>, |
| 12 | + React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> |
13 | 13 | >(({ className, ...props }, ref) => ( |
14 | | - <DialogPrimitive.Overlay |
15 | | - ref={ref} |
16 | | - className={cn( |
17 | | - '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/80', |
18 | | - className, |
19 | | - )} |
20 | | - {...props} |
21 | | - /> |
| 14 | + <DialogPrimitive.Overlay |
| 15 | + ref={ref} |
| 16 | + className={cn( |
| 17 | + "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/80", |
| 18 | + className, |
| 19 | + )} |
| 20 | + {...props} |
| 21 | + /> |
22 | 22 | )); |
23 | 23 | DialogOverlay.displayName = DialogPrimitive.Overlay.displayName; |
24 | 24 | const DialogContent = React.forwardRef< |
25 | | - React.ElementRef<typeof DialogPrimitive.Content>, |
26 | | - React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> |
| 25 | + React.ElementRef<typeof DialogPrimitive.Content>, |
| 26 | + React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> |
27 | 27 | >(({ className, children, ...props }, ref) => ( |
28 | | - <DialogPortal> |
29 | | - <DialogOverlay /> |
30 | | - <DialogPrimitive.Content |
31 | | - ref={ref} |
32 | | - className={cn( |
33 | | - '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 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg', |
34 | | - className, |
35 | | - )} |
36 | | - {...props} |
37 | | - > |
38 | | - {children} |
39 | | - {/* <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"> |
| 28 | + <DialogPortal> |
| 29 | + <DialogOverlay /> |
| 30 | + <DialogPrimitive.Content |
| 31 | + ref={ref} |
| 32 | + className={cn( |
| 33 | + "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 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg", |
| 34 | + className, |
| 35 | + )} |
| 36 | + {...props} |
| 37 | + > |
| 38 | + {children} |
| 39 | + {/* <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"> |
40 | 40 | <X className="h-4 w-4" /> |
41 | 41 | <span className="sr-only">Close</span> |
42 | 42 | </DialogPrimitive.Close> */} |
43 | | - </DialogPrimitive.Content> |
44 | | - </DialogPortal> |
| 43 | + </DialogPrimitive.Content> |
| 44 | + </DialogPortal> |
45 | 45 | )); |
46 | 46 | DialogContent.displayName = DialogPrimitive.Content.displayName; |
47 | 47 | const DialogHeader = ({ |
48 | | - className, |
49 | | - ...props |
| 48 | + className, |
| 49 | + ...props |
50 | 50 | }: React.HTMLAttributes<HTMLDivElement>) => ( |
51 | | - <div |
52 | | - className={cn( |
53 | | - 'flex flex-col space-y-1.5 text-center sm:text-left', |
54 | | - className, |
55 | | - )} |
56 | | - {...props} |
57 | | - /> |
| 51 | + <div |
| 52 | + className={cn( |
| 53 | + "flex flex-col space-y-1.5 text-center sm:text-left", |
| 54 | + className, |
| 55 | + )} |
| 56 | + {...props} |
| 57 | + /> |
58 | 58 | ); |
59 | | -DialogHeader.displayName = 'DialogHeader'; |
| 59 | +DialogHeader.displayName = "DialogHeader"; |
60 | 60 | const DialogFooter = ({ |
61 | | - className, |
62 | | - ...props |
| 61 | + className, |
| 62 | + ...props |
63 | 63 | }: React.HTMLAttributes<HTMLDivElement>) => ( |
64 | | - <div |
65 | | - className={cn( |
66 | | - 'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', |
67 | | - className, |
68 | | - )} |
69 | | - {...props} |
70 | | - /> |
| 64 | + <div |
| 65 | + className={cn( |
| 66 | + "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", |
| 67 | + className, |
| 68 | + )} |
| 69 | + {...props} |
| 70 | + /> |
71 | 71 | ); |
72 | | -DialogFooter.displayName = 'DialogFooter'; |
| 72 | +DialogFooter.displayName = "DialogFooter"; |
73 | 73 | const DialogTitle = React.forwardRef< |
74 | | - React.ElementRef<typeof DialogPrimitive.Title>, |
75 | | - React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title> |
| 74 | + React.ElementRef<typeof DialogPrimitive.Title>, |
| 75 | + React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title> |
76 | 76 | >(({ className, ...props }, ref) => ( |
77 | | - <DialogPrimitive.Title |
78 | | - ref={ref} |
79 | | - className={cn( |
80 | | - 'text-lg font-semibold leading-none tracking-tight', |
81 | | - className, |
82 | | - )} |
83 | | - {...props} |
84 | | - /> |
| 77 | + <DialogPrimitive.Title |
| 78 | + ref={ref} |
| 79 | + className={cn("t3 leading-none tracking-tight", className)} |
| 80 | + {...props} |
| 81 | + /> |
85 | 82 | )); |
86 | 83 | DialogTitle.displayName = DialogPrimitive.Title.displayName; |
87 | 84 | const DialogDescription = React.forwardRef< |
88 | | - React.ElementRef<typeof DialogPrimitive.Description>, |
89 | | - React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description> |
| 85 | + React.ElementRef<typeof DialogPrimitive.Description>, |
| 86 | + React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description> |
90 | 87 | >(({ className, ...props }, ref) => ( |
91 | | - <DialogPrimitive.Description |
92 | | - ref={ref} |
93 | | - className={cn('text-muted-foreground text-sm', className)} |
94 | | - {...props} |
95 | | - /> |
| 88 | + <DialogPrimitive.Description |
| 89 | + ref={ref} |
| 90 | + className={cn("text-muted-foreground text-sm", className)} |
| 91 | + {...props} |
| 92 | + /> |
96 | 93 | )); |
97 | 94 | DialogDescription.displayName = DialogPrimitive.Description.displayName; |
98 | 95 | export { |
99 | | - Dialog, |
100 | | - DialogPortal, |
101 | | - DialogOverlay, |
102 | | - DialogClose, |
103 | | - DialogTrigger, |
104 | | - DialogContent, |
105 | | - DialogHeader, |
106 | | - DialogFooter, |
107 | | - DialogTitle, |
108 | | - DialogDescription, |
| 96 | + Dialog, |
| 97 | + DialogPortal, |
| 98 | + DialogOverlay, |
| 99 | + DialogClose, |
| 100 | + DialogTrigger, |
| 101 | + DialogContent, |
| 102 | + DialogHeader, |
| 103 | + DialogFooter, |
| 104 | + DialogTitle, |
| 105 | + DialogDescription, |
109 | 106 | }; |
0 commit comments