|
1 | 1 | import { SearchIcon } from "@heroicons/react/outline"; |
2 | 2 | import { ShortcutIcon } from "./Icons/ShortcutIcon"; |
3 | 3 | import { Body } from "./Primitives/Body"; |
| 4 | +import { Dialog, DialogTrigger, DialogContent } from "./UI/Dialog"; |
4 | 5 |
|
5 | 6 | export type SearchBarProps = { |
6 | 7 | className?: string; |
7 | 8 | }; |
8 | 9 |
|
| 10 | +import classnames from "~/utilities/classnames"; |
| 11 | + |
9 | 12 | export function SearchBar({ className }: SearchBarProps) { |
10 | 13 | return ( |
11 | | - <div className="flex justify-between items-center group w-44 rounded-sm bg-slate-300 transition hover:bg-slate-400 hover:bg-opacity-50 dark:bg-slate-800 dark:text-slate-400 hover:cursor-pointer hover:dark:bg-slate-700 hover:dark:bg-opacity-70"> |
12 | | - <div className="flex items-center pl-2"> |
13 | | - <SearchIcon className="w-4 h-4 mr-1" /> |
14 | | - <Body>Search…</Body> |
15 | | - </div> |
16 | | - <div className="flex items-center gap-1 pr-2"> |
17 | | - <ShortcutIcon className="w-4 h-4 text-sm bg-slate-200 transition group-hover:bg-slate-100 dark:bg-slate-700 dark:group-hover:bg-slate-600"> |
18 | | - ⌘ |
19 | | - </ShortcutIcon> |
20 | | - <ShortcutIcon className="w-4 h-4 text-sm bg-slate-200 transition group-hover:bg-slate-100 dark:bg-slate-700 dark:group-hover:bg-slate-600"> |
21 | | - K |
22 | | - </ShortcutIcon> |
23 | | - </div> |
24 | | - </div> |
| 14 | + <Dialog> |
| 15 | + <DialogTrigger> |
| 16 | + <div className="flex justify-between items-center group w-44 rounded-sm bg-slate-300 transition hover:bg-slate-400 hover:bg-opacity-50 dark:bg-slate-800 dark:text-slate-400 hover:cursor-pointer hover:dark:bg-slate-700 hover:dark:bg-opacity-70"> |
| 17 | + <div className="flex items-center pl-2"> |
| 18 | + <SearchIcon className="w-4 h-4 mr-1" /> |
| 19 | + <Body>Search…</Body> |
| 20 | + </div> |
| 21 | + <div className="flex items-center gap-1 pr-2"> |
| 22 | + <ShortcutIcon className="w-4 h-4 text-sm bg-slate-200 transition group-hover:bg-slate-100 dark:bg-slate-700 dark:group-hover:bg-slate-600"> |
| 23 | + ⌘ |
| 24 | + </ShortcutIcon> |
| 25 | + <ShortcutIcon className="w-4 h-4 text-sm bg-slate-200 transition group-hover:bg-slate-100 dark:bg-slate-700 dark:group-hover:bg-slate-600"> |
| 26 | + K |
| 27 | + </ShortcutIcon> |
| 28 | + </div> |
| 29 | + </div> |
| 30 | + </DialogTrigger> |
| 31 | + <DialogContent |
| 32 | + className={classnames( |
| 33 | + "fixed z-50", |
| 34 | + "w-[95vw] max-w-md rounded-lg p-4 md:w-full", |
| 35 | + "top-[30%] left-[50%] -translate-x-[50%] -translate-y-[50%]", |
| 36 | + "bg-white dark:bg-gray-800", |
| 37 | + "focus:outline-none focus-visible:ring focus-visible:ring-purple-500 focus-visible:ring-opacity-75" |
| 38 | + )} |
| 39 | + > |
| 40 | + <SearchCommandPalette /> |
| 41 | + </DialogContent> |
| 42 | + </Dialog> |
25 | 43 | ); |
26 | 44 | } |
| 45 | + |
| 46 | +export default function SearchCommandPalette() { |
| 47 | + return <div className="text-center">Search Command Palette</div>; |
| 48 | +} |
0 commit comments