diff --git a/components/Command/Command.tsx b/components/Command/Command.tsx index 39bbc0a..49bc45f 100644 --- a/components/Command/Command.tsx +++ b/components/Command/Command.tsx @@ -13,15 +13,29 @@ import { CommandList, CommandSeparator, } from '@/components/ui/command'; +import { + CircleUserRound, + Home, + MoonStar, + Paperclip, + Rss, + SquareArrowOutUpRight, + SquareBottomDashedScissors, + SunMoon, + Tag, + Target, +} from 'lucide-react'; export function CommandMenu({ blogs, projects, snippets, + tags, }: { blogs: any[]; projects: any[]; snippets: any[]; + tags: any[]; }) { const router = useRouter(); const [open, setOpen] = React.useState(false); @@ -55,83 +69,119 @@ export function CommandMenu({ return ( <> - + No results found. - + runCommand(() => router.push('/home'))} > + Home + runCommand(() => router.push('/contact'))} + > + + Contact + + runCommand(() => router.push('/resume'))} + > + + Resume + + runCommand(() => router.push('/blog'))} + > + + Blogs + + runCommand(() => router.push('/projects'))} + > + + Projects + + runCommand(() => router.push('/snippet'))} + > + + Snippets + runCommand(() => router.push('/tag'))}> + Tags - + + + + {blogs.map((blog: any) => ( + + runCommand(() => router.push(`/blog/${blog.slug}`)) + } + > + + {blog.metadata.title} + + + ))} + + + + {projects.map((project: any) => ( runCommand(() => router.push('/blog'))} + key={project.slug} + onSelect={() => + runCommand(() => router.push(`/projects/${project.slug}`)) + } > - Blogs + + {project.metadata.title} + - {blogs.map((blog: any) => ( - - runCommand(() => router.push(`/blog/${blog.slug}`)) - } - > - - {blog.metadata.title} - - ))} - - + ))} + + + + {snippets.map((snippet: any) => ( runCommand(() => router.push('/projects'))} + key={snippet.slug} + onSelect={() => + runCommand(() => router.push(`/snippets/${snippet.slug}`)) + } > - Projects + + {snippet.metadata.title} + - {projects.map((project: any) => ( - - runCommand(() => router.push(`/projects/${project.slug}`)) - } - > - - {project.metadata.title} - - ))} - - + ))} + + + + {tags.map((tag: any) => ( runCommand(() => router.push('/snippet'))} + key={tag} + onSelect={() => runCommand(() => router.push(`/tag/${tag}`))} > - Snippets + + {tag} + - {snippets.map((snippet: any) => ( - - runCommand(() => router.push(`/snippets/${snippet.slug}`)) - } - > - - {snippet.metadata.title} - - ))} - + ))} - + runCommand(() => setTheme('light'))}> - + Light runCommand(() => setTheme('dark'))}> - + Dark diff --git a/components/Command/CommandContainer.tsx b/components/Command/CommandContainer.tsx index a6a56ed..e4ac7c8 100644 --- a/components/Command/CommandContainer.tsx +++ b/components/Command/CommandContainer.tsx @@ -1,16 +1,25 @@ import getBlogs from '@/lib/get-blogs'; import { getProjects } from '@/lib/get-projects'; import getSnippets from '@/lib/get-snippets'; +import { allTags } from '@/lib/get-tags'; import { CommandMenu } from './Command'; export function CommandContainer() { const blogs = getBlogs(); const projects = getProjects(); const snippets = getSnippets(); + const tags = Object.keys(allTags); + + tags.sort(); return ( <> - + ); } diff --git a/components/ui/command.tsx b/components/ui/command.tsx index 944f72d..3fe2fbf 100644 --- a/components/ui/command.tsx +++ b/components/ui/command.tsx @@ -23,9 +23,7 @@ const Command = React.forwardRef< )); Command.displayName = CommandPrimitive.displayName; -interface CommandDialogProps extends DialogProps { - className?: string; -} +interface CommandDialogProps extends DialogProps {} const CommandDialog = ({ children, ...props }: CommandDialogProps) => { return ( @@ -106,7 +104,7 @@ const CommandSeparator = React.forwardRef< >(({ className, ...props }, ref) => ( ));