blob: 08bed2a8e32a5c86fea2b8fd177f7703c59c6a66 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
import { useState } from "react";
import { ArrowPathIcon } from "@heroicons/react/24/outline";
import { MagnifyingGlassIcon } from "@heroicons/react/20/solid";
interface HistorySearchProps {
refresh: (query: string) => void;
}
export default function HistorySearch(props: HistorySearchProps) {
let [searchQuery, setSearchQuery] = useState("");
return (
<div className="flex flex-1 gap-x-4 self-stretch lg:gap-x-6">
<form
className="relative flex flex-1"
onSubmit={(e) => {
e.preventDefault();
}}
>
<label htmlFor="search-field" className="sr-only">
Search
</label>
<MagnifyingGlassIcon
className="pointer-events-none absolute inset-y-0 left-0 h-full w-5 text-gray-400"
aria-hidden="true"
/>
<input
id="search-field"
className="block h-full w-full border-0 py-0 pl-8 pr-0 text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm"
placeholder="Search..."
autoComplete="off"
autoCapitalize="off"
autoCorrect="off"
spellCheck="false"
type="search"
name="search"
onChange={(query) => {
setSearchQuery(query.target.value);
props.refresh(query.target.value);
}}
/>
</form>
<div className="flex items-center gap-x-4 lg:gap-x-6">
<button
type="button"
className="-m-2.5 p-2.5 text-gray-400 hover:text-gray-500"
onClick={() => {
props.refresh(searchQuery);
}}
>
<ArrowPathIcon className="h-6 w-6" aria-hidden="true" />
</button>
</div>
</div>
);
}
|