diff --git a/package.json b/package.json index 3e25071..b78bce0 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "@uploadthing/react": "^6.2.2", "class-variance-authority": "^0.7.0", "clsx": "^2.1.0", + "cmdk": "^1.0.0", "framer-motion": "^11.1.1", "install": "^0.13.0", "lucide-react": "^0.325.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e67a3de..ead232c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -65,6 +65,9 @@ dependencies: clsx: specifier: ^2.1.0 version: 2.1.0 + cmdk: + specifier: ^1.0.0 + version: 1.0.0(@types/react-dom@18.2.21)(@types/react@18.2.65)(react-dom@18.2.0)(react@18.2.0) framer-motion: specifier: ^11.1.1 version: 11.1.1(react-dom@18.2.0)(react@18.2.0) @@ -2063,6 +2066,21 @@ packages: engines: {node: '>=6'} dev: false + /cmdk@1.0.0(@types/react-dom@18.2.21)(@types/react@18.2.65)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-gDzVf0a09TvoJ5jnuPvygTB77+XdOSwEmJ88L6XPFPlv7T3RxbP9jgenfylrAMD0+Le1aO0nVjQUzl2g+vjz5Q==} + peerDependencies: + react: ^18.0.0 + react-dom: ^18.0.0 + dependencies: + '@radix-ui/react-dialog': 1.0.5(@types/react-dom@18.2.21)(@types/react@18.2.65)(react-dom@18.2.0)(react@18.2.0) + '@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.2.21)(@types/react@18.2.65)(react-dom@18.2.0)(react@18.2.0) + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + transitivePeerDependencies: + - '@types/react' + - '@types/react-dom' + dev: false + /color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} engines: {node: '>=7.0.0'} diff --git a/src/components/sidebar/menu-options.tsx b/src/components/sidebar/menu-options.tsx index efc1ae5..477fc04 100644 --- a/src/components/sidebar/menu-options.tsx +++ b/src/components/sidebar/menu-options.tsx @@ -16,7 +16,8 @@ import { AspectRatio } from '../ui/aspect-ratio' import Image from 'next/image' import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover' import Compass from '../icons/compass' -// import { Command } from '../ui/command' +import { Command } from '../ui/command' + type Props = { @@ -111,9 +112,9 @@ const MenuOptions = ({ - {/* + - */} + diff --git a/src/components/ui/command.tsx b/src/components/ui/command.tsx index 9919fae..b38978f 100644 --- a/src/components/ui/command.tsx +++ b/src/components/ui/command.tsx @@ -1,159 +1,159 @@ -// 'use client' - -// import * as React from 'react' -// import { type DialogProps } from '@radix-ui/react-dialog' -// import { Command as CommandPrimitive } from 'cmdk' -// import { Search } from 'lucide-react' - -// import { cn } from '@/lib/utils' -// import { Dialog, DialogContent } from '@/components/ui/dialog' - -// const Command = React.forwardRef< -// React.ElementRef, -// React.ComponentPropsWithoutRef -// >(({ className, ...props }, ref) => ( -// -// )) -// Command.displayName = CommandPrimitive.displayName - -// interface CommandDialogProps extends DialogProps { } - -// const CommandDialog = ({ children, ...props }: CommandDialogProps) => { -// return ( -// -// -// -// {children} -// -// -// -// ) -// } - -// const CommandInput = React.forwardRef< -// React.ElementRef, -// React.ComponentPropsWithoutRef -// >(({ className, ...props }, ref) => ( -//
-// -// -//
-// )) - -// CommandInput.displayName = CommandPrimitive.Input.displayName - -// const CommandList = React.forwardRef< -// React.ElementRef, -// React.ComponentPropsWithoutRef -// >(({ className, ...props }, ref) => ( -// -// )) - -// CommandList.displayName = CommandPrimitive.List.displayName - -// const CommandEmpty = React.forwardRef< -// React.ElementRef, -// React.ComponentPropsWithoutRef -// >((props, ref) => ( -// -// )) - -// CommandEmpty.displayName = CommandPrimitive.Empty.displayName - -// const CommandGroup = React.forwardRef< -// React.ElementRef, -// React.ComponentPropsWithoutRef -// >(({ className, ...props }, ref) => ( -// -// )) - -// CommandGroup.displayName = CommandPrimitive.Group.displayName - -// const CommandSeparator = React.forwardRef< -// React.ElementRef, -// React.ComponentPropsWithoutRef -// >(({ className, ...props }, ref) => ( -// -// )) -// CommandSeparator.displayName = CommandPrimitive.Separator.displayName - -// //CHANGED: -// const CommandItem = React.forwardRef< -// React.ElementRef, -// React.ComponentPropsWithoutRef -// >(({ className, ...props }, ref) => ( -// -// )) - -// CommandItem.displayName = CommandPrimitive.Item.displayName - -// const CommandShortcut = ({ -// className, -// ...props -// }: React.HTMLAttributes) => { -// return ( -// -// ) -// } -// CommandShortcut.displayName = 'CommandShortcut' - -// export { -// Command, -// CommandDialog, -// CommandInput, -// CommandList, -// CommandEmpty, -// CommandGroup, -// CommandItem, -// CommandShortcut, -// CommandSeparator, -// } \ No newline at end of file +'use client' + +import * as React from 'react' +import { type DialogProps } from '@radix-ui/react-dialog' +import { Command as CommandPrimitive } from 'cmdk' +import { Search } from 'lucide-react' + +import { cn } from '@/lib/utils' +import { Dialog, DialogContent } from '@/components/ui/dialog' + +const Command = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +Command.displayName = CommandPrimitive.displayName + +interface CommandDialogProps extends DialogProps { } + +const CommandDialog = ({ children, ...props }: CommandDialogProps) => { + return ( + + + + {children} + + + + ) +} + +const CommandInput = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( +
+ + +
+)) + +CommandInput.displayName = CommandPrimitive.Input.displayName + +const CommandList = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) + +CommandList.displayName = CommandPrimitive.List.displayName + +const CommandEmpty = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>((props, ref) => ( + +)) + +CommandEmpty.displayName = CommandPrimitive.Empty.displayName + +const CommandGroup = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) + +CommandGroup.displayName = CommandPrimitive.Group.displayName + +const CommandSeparator = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +CommandSeparator.displayName = CommandPrimitive.Separator.displayName + +//CHANGED: +const CommandItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) + +CommandItem.displayName = CommandPrimitive.Item.displayName + +const CommandShortcut = ({ + className, + ...props +}: React.HTMLAttributes) => { + return ( + + ) +} +CommandShortcut.displayName = 'CommandShortcut' + +export { + Command, + CommandDialog, + CommandInput, + CommandList, + CommandEmpty, + CommandGroup, + CommandItem, + CommandShortcut, + CommandSeparator, +} \ No newline at end of file diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsx new file mode 100644 index 0000000..367abe5 --- /dev/null +++ b/src/components/ui/dialog.tsx @@ -0,0 +1,122 @@ +"use client" + +import * as React from "react" +import * as DialogPrimitive from "@radix-ui/react-dialog" +import { X } from "lucide-react" + +import { cn } from "@/lib/utils" + +const Dialog = DialogPrimitive.Root + +const DialogTrigger = DialogPrimitive.Trigger + +const DialogPortal = DialogPrimitive.Portal + +const DialogClose = DialogPrimitive.Close + +const DialogOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogOverlay.displayName = DialogPrimitive.Overlay.displayName + +const DialogContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + + + {children} + + + Close + + + +)) +DialogContent.displayName = DialogPrimitive.Content.displayName + +const DialogHeader = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +DialogHeader.displayName = "DialogHeader" + +const DialogFooter = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +DialogFooter.displayName = "DialogFooter" + +const DialogTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogTitle.displayName = DialogPrimitive.Title.displayName + +const DialogDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogDescription.displayName = DialogPrimitive.Description.displayName + +export { + Dialog, + DialogPortal, + DialogOverlay, + DialogClose, + DialogTrigger, + DialogContent, + DialogHeader, + DialogFooter, + DialogTitle, + DialogDescription, +} \ No newline at end of file