Skip to content

Commit eb26702

Browse files
committed
adding chatgpt 3.5 turbo
1 parent 074bda0 commit eb26702

File tree

7 files changed

+334
-0
lines changed

7 files changed

+334
-0
lines changed

components/ui/command.jsx

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
"use client";
2+
import * as React from "react"
3+
import { MagnifyingGlassIcon } from "@radix-ui/react-icons"
4+
import { Command as CommandPrimitive } from "cmdk"
5+
6+
import { cn } from "@/lib/utils"
7+
import { Dialog, DialogContent } from "@/components/ui/dialog"
8+
9+
const Command = React.forwardRef(({ className, ...props }, ref) => (
10+
<CommandPrimitive
11+
ref={ref}
12+
className={cn(
13+
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
14+
className
15+
)}
16+
{...props} />
17+
))
18+
Command.displayName = CommandPrimitive.displayName
19+
20+
const CommandDialog = ({
21+
children,
22+
...props
23+
}) => {
24+
return (
25+
(<Dialog {...props}>
26+
<DialogContent className="overflow-hidden p-0">
27+
<Command
28+
className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
29+
{children}
30+
</Command>
31+
</DialogContent>
32+
</Dialog>)
33+
);
34+
}
35+
36+
const CommandInput = React.forwardRef(({ className, ...props }, ref) => (
37+
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
38+
<MagnifyingGlassIcon className="mr-2 h-4 w-4 shrink-0 opacity-50" />
39+
<CommandPrimitive.Input
40+
ref={ref}
41+
className={cn(
42+
"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
43+
className
44+
)}
45+
{...props} />
46+
</div>
47+
))
48+
49+
CommandInput.displayName = CommandPrimitive.Input.displayName
50+
51+
const CommandList = React.forwardRef(({ className, ...props }, ref) => (
52+
<CommandPrimitive.List
53+
ref={ref}
54+
className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
55+
{...props} />
56+
))
57+
58+
CommandList.displayName = CommandPrimitive.List.displayName
59+
60+
const CommandEmpty = React.forwardRef((props, ref) => (
61+
<CommandPrimitive.Empty ref={ref} className="py-6 text-center text-sm" {...props} />
62+
))
63+
64+
CommandEmpty.displayName = CommandPrimitive.Empty.displayName
65+
66+
const CommandGroup = React.forwardRef(({ className, ...props }, ref) => (
67+
<CommandPrimitive.Group
68+
ref={ref}
69+
className={cn(
70+
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
71+
className
72+
)}
73+
{...props} />
74+
))
75+
76+
CommandGroup.displayName = CommandPrimitive.Group.displayName
77+
78+
const CommandSeparator = React.forwardRef(({ className, ...props }, ref) => (
79+
<CommandPrimitive.Separator ref={ref} className={cn("-mx-1 h-px bg-border", className)} {...props} />
80+
))
81+
CommandSeparator.displayName = CommandPrimitive.Separator.displayName
82+
83+
const CommandItem = React.forwardRef(({ className, ...props }, ref) => (
84+
<CommandPrimitive.Item
85+
ref={ref}
86+
className={cn(
87+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
88+
className
89+
)}
90+
{...props} />
91+
))
92+
93+
CommandItem.displayName = CommandPrimitive.Item.displayName
94+
95+
const CommandShortcut = ({
96+
className,
97+
...props
98+
}) => {
99+
return (
100+
(<span
101+
className={cn("ml-auto text-xs tracking-widest text-muted-foreground", className)}
102+
{...props} />)
103+
);
104+
}
105+
CommandShortcut.displayName = "CommandShortcut"
106+
107+
export {
108+
Command,
109+
CommandDialog,
110+
CommandInput,
111+
CommandList,
112+
CommandEmpty,
113+
CommandGroup,
114+
CommandItem,
115+
CommandShortcut,
116+
CommandSeparator,
117+
}

components/ui/dialog.jsx

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

components/ui/hover-card.jsx

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"use client"
2+
3+
import * as React from "react"
4+
import * as HoverCardPrimitive from "@radix-ui/react-hover-card"
5+
6+
import { cn } from "@/lib/utils"
7+
8+
const HoverCard = HoverCardPrimitive.Root
9+
10+
const HoverCardTrigger = HoverCardPrimitive.Trigger
11+
12+
const HoverCardContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
13+
<HoverCardPrimitive.Content
14+
ref={ref}
15+
align={align}
16+
sideOffset={sideOffset}
17+
className={cn(
18+
"z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
19+
className
20+
)}
21+
{...props} />
22+
))
23+
HoverCardContent.displayName = HoverCardPrimitive.Content.displayName
24+
25+
export { HoverCard, HoverCardTrigger, HoverCardContent }

components/ui/popover.jsx

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"use client"
2+
3+
import * as React from "react"
4+
import * as PopoverPrimitive from "@radix-ui/react-popover"
5+
6+
import { cn } from "@/lib/utils"
7+
8+
const Popover = PopoverPrimitive.Root
9+
10+
const PopoverTrigger = PopoverPrimitive.Trigger
11+
12+
const PopoverAnchor = PopoverPrimitive.Anchor
13+
14+
const PopoverContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
15+
<PopoverPrimitive.Portal>
16+
<PopoverPrimitive.Content
17+
ref={ref}
18+
align={align}
19+
sideOffset={sideOffset}
20+
className={cn(
21+
"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
22+
className
23+
)}
24+
{...props} />
25+
</PopoverPrimitive.Portal>
26+
))
27+
PopoverContent.displayName = PopoverPrimitive.Content.displayName
28+
29+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }

components/ui/slider.jsx

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"use client"
2+
3+
import * as React from "react"
4+
import * as SliderPrimitive from "@radix-ui/react-slider"
5+
6+
import { cn } from "@/lib/utils"
7+
8+
const Slider = React.forwardRef(({ className, ...props }, ref) => (
9+
<SliderPrimitive.Root
10+
ref={ref}
11+
className={cn("relative flex w-full touch-none select-none items-center", className)}
12+
{...props}>
13+
<SliderPrimitive.Track
14+
className="relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20">
15+
<SliderPrimitive.Range className="absolute h-full bg-primary" />
16+
</SliderPrimitive.Track>
17+
<SliderPrimitive.Thumb
18+
className="block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50" />
19+
</SliderPrimitive.Root>
20+
))
21+
Slider.displayName = SliderPrimitive.Root.displayName
22+
23+
export { Slider }

components/ui/textarea.jsx

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import * as React from "react"
2+
3+
import { cn } from "@/lib/utils"
4+
5+
const Textarea = React.forwardRef(({ className, ...props }, ref) => {
6+
return (
7+
(<textarea
8+
className={cn(
9+
"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
10+
className
11+
)}
12+
ref={ref}
13+
{...props} />)
14+
);
15+
})
16+
Textarea.displayName = "Textarea"
17+
18+
export { Textarea }

components/ui/tooltip.jsx

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"use client"
2+
3+
import * as React from "react"
4+
import * as TooltipPrimitive from "@radix-ui/react-tooltip"
5+
6+
import { cn } from "@/lib/utils"
7+
8+
const TooltipProvider = TooltipPrimitive.Provider
9+
10+
const Tooltip = TooltipPrimitive.Root
11+
12+
const TooltipTrigger = TooltipPrimitive.Trigger
13+
14+
const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (
15+
<TooltipPrimitive.Content
16+
ref={ref}
17+
sideOffset={sideOffset}
18+
className={cn(
19+
"z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
20+
className
21+
)}
22+
{...props} />
23+
))
24+
TooltipContent.displayName = TooltipPrimitive.Content.displayName
25+
26+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }

0 commit comments

Comments
 (0)