From ee9170e49fc0597ac1639172a90838e17b3fd9ec Mon Sep 17 00:00:00 2001 From: Mehdi BHA Date: Sat, 26 Oct 2024 20:48:42 +0100 Subject: [PATCH] chore: upgrade cmdk to 1.0 --- www/src/components/search-command.tsx | 8 +++++--- www/src/lib/string.ts | 4 +--- www/src/registry/ui/default/core/command/command.tsx | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/www/src/components/search-command.tsx b/www/src/components/search-command.tsx index 33170674..6805609e 100644 --- a/www/src/components/search-command.tsx +++ b/www/src/components/search-command.tsx @@ -2,6 +2,7 @@ import React from "react"; import { useRouter } from "next/navigation"; +import { Command } from "cmdk"; import { useDocsSearch } from "fumadocs-core/search/client"; import { SortedResult } from "fumadocs-core/server"; import { @@ -28,7 +29,6 @@ import { } from "@/registry/ui/default/core/command"; import { cn } from "@/registry/ui/default/lib/cn"; import { searchConfig } from "@/config"; -import { Command } from "cmdk"; export const SearchCommand = ({ className, @@ -45,7 +45,7 @@ export const SearchCommand = ({ const router = useRouter(); const results = - query.data === "empty" + search === "" || query.data === "empty" ? [ { id: "suggestions", @@ -112,7 +112,9 @@ export const SearchCommand = ({ )} - No results found + {query.data !== "empty" && ( + No results found + )} {results.map((group) => ( {group.results.map((item) => ( diff --git a/www/src/lib/string.ts b/www/src/lib/string.ts index 658f638f..81101771 100644 --- a/www/src/lib/string.ts +++ b/www/src/lib/string.ts @@ -24,9 +24,7 @@ export const toKebabCase = (string: string): string => { }; export const kekabCaseToTitle = (string: string): string => { - return string - .replace(/-/g, " ") - .replace(/^\w/, (char) => char.toUpperCase()); + return string.replace(/-/g, " ").replace(/^\w/, (char) => char.toUpperCase()); }; export const truncateOnWord = ( diff --git a/www/src/registry/ui/default/core/command/command.tsx b/www/src/registry/ui/default/core/command/command.tsx index 355adb91..4bd43be8 100644 --- a/www/src/registry/ui/default/core/command/command.tsx +++ b/www/src/registry/ui/default/core/command/command.tsx @@ -88,7 +88,7 @@ const CommandGroup = React.forwardRef<