Skip to content

Commit

Permalink
chore: upgrade cmdk to 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdibha committed Oct 26, 2024
1 parent 29b3afb commit ee9170e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 5 additions & 3 deletions www/src/components/search-command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
Expand All @@ -45,7 +45,7 @@ export const SearchCommand = ({
const router = useRouter();

const results =
query.data === "empty"
search === "" || query.data === "empty"
? [
{
id: "suggestions",
Expand Down Expand Up @@ -112,7 +112,9 @@ export const SearchCommand = ({
<CommandSeparator className="before:opacity-1 before:animate-loading before:delay-900 relative h-[2px] overflow-hidden before:absolute before:left-0 before:top-0 before:h-full before:w-1/2 before:bg-[linear-gradient(90deg,rgba(0,0,0,0)_0,#707070_50%,rgba(0,0,0,0)_100%)] before:opacity-0 before:content-['']" />
)}
<CommandList>
<CommandEmpty>No results found</CommandEmpty>
{query.data !== "empty" && (
<CommandEmpty>No results found</CommandEmpty>
)}
{results.map((group) => (
<CommandGroup key={group.id} heading={group.name}>
{group.results.map((item) => (
Expand Down
4 changes: 1 addition & 3 deletions www/src/lib/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down
2 changes: 1 addition & 1 deletion www/src/registry/ui/default/core/command/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const CommandGroup = React.forwardRef<
<CommandPrimitive.Group
ref={ref}
className={cn(
"text-foreground [&_[cmdk-group-heading]]:text-fg-muted overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
"text-fg [&_[cmdk-group-heading]]:text-fg-muted overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
className
)}
{...props}
Expand Down

0 comments on commit ee9170e

Please sign in to comment.