-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from ArkProjectNFTs/feature/dev-368-header-search
Feature/dev 368 header search
- Loading branch information
Showing
7 changed files
with
96 additions
and
14 deletions.
There are no files selected for viewing
12 changes: 10 additions & 2 deletions
12
apps/arkmarket/app/collection/[collectionAddress]/components/header.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
"use client"; | ||
|
||
import * as React from "react"; | ||
|
||
import { Button } from "@ark-market/ui/components/button"; | ||
import { | ||
CommandDialog, | ||
CommandEmpty, | ||
CommandGroup, | ||
CommandInput, | ||
CommandItem, | ||
CommandList, | ||
CommandSeparator, | ||
CommandShortcut, | ||
} from "@ark-market/ui/components/command"; | ||
import { cn } from "@ark-market/ui/lib/utils"; | ||
|
||
export function CommandMenu({ ...props }) { | ||
const [open, setOpen] = React.useState(false); | ||
|
||
React.useEffect(() => { | ||
const down = (e: KeyboardEvent) => { | ||
if (e.key === "k" && (e.metaKey || e.ctrlKey)) { | ||
e.preventDefault(); | ||
setOpen((open) => !open); | ||
} | ||
}; | ||
|
||
document.addEventListener("keydown", down); | ||
return () => document.removeEventListener("keydown", down); | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<Button | ||
variant="outline" | ||
className={cn( | ||
"relative h-10 w-full justify-start rounded-[0.5rem] bg-background text-sm font-normal text-muted-foreground shadow-none sm:pr-12 md:w-40 lg:w-72", | ||
)} | ||
onClick={() => setOpen(true)} | ||
{...props} | ||
> | ||
<span className="hidden lg:inline-flex">Search collections...</span> | ||
<span className="inline-flex lg:hidden">Search...</span> | ||
<kbd className="pointer-events-none absolute right-[0.3rem] top-[0.3rem] hidden h-7 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 sm:flex"> | ||
<span className="text-xs">⌘</span>K | ||
</kbd> | ||
</Button> | ||
<CommandDialog open={open} onOpenChange={setOpen}> | ||
<CommandInput placeholder="Type a collection name..." /> | ||
<CommandList> | ||
<CommandEmpty>No results found.</CommandEmpty> | ||
</CommandList> | ||
</CommandDialog> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters