From 96b15f6090c2158ab36614a6ecfee552f5dbc49d Mon Sep 17 00:00:00 2001 From: shadcn Date: Wed, 9 Jul 2025 12:43:50 +0400 Subject: [PATCH] feat: update command menu pages and filtering (#7771) --- apps/v4/components/command-menu.tsx | 37 ++++++++++++++++++++++++++++- apps/v4/components/site-header.tsx | 6 ++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/apps/v4/components/command-menu.tsx b/apps/v4/components/command-menu.tsx index b76588910d..ccc3522bbf 100644 --- a/apps/v4/components/command-menu.tsx +++ b/apps/v4/components/command-menu.tsx @@ -36,11 +36,13 @@ export function CommandMenu({ tree, colors, blocks, + navItems, ...props }: DialogProps & { tree: typeof source.pageTree colors: ColorPalette[] blocks?: { name: string; description: string; categories: string[] }[] + navItems?: { href: string; label: string }[] }) { const router = useRouter() const isMac = useIsMac() @@ -162,12 +164,45 @@ export function CommandMenu({ Search documentation... Search for a command to run... - + { + const extendValue = value + " " + (keywords?.join(" ") || "") + if (extendValue.toLowerCase().includes(search.toLowerCase())) { + return 1 + } + return 0 + }} + > No results found. + {navItems && navItems.length > 0 && ( + + {navItems.map((item) => ( + { + setSelectedType("page") + setCopyPayload("") + }} + onSelect={() => { + runCommand(() => router.push(item.href)) + }} + > + + {item.label} + + ))} + + )} {tree.children.map((group) => (
- +