MCPcopy Create free account
hub / github.com/caesarHQ/textSQL / SearchBar

Function SearchBar

client/censusGPT/src/components/searchBar.js:18–74  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

16}
17
18const SearchBar = (props) => {
19 const {
20 value,
21 onSearchChange,
22 onClear,
23 suggestedQuery,
24 setTitle,
25 setQuery,
26 fetchBackend,
27 currentSuggestionId,
28 } = props
29
30 return (
31 <div className="flex flex-col w-full max-w-full md:max-w-3xl">
32 <div className="flex rounded-md">
33 <div className="relative flex flex-grow items-stretch focus-within:z-10 shadow-sm bg-white dark:bg-dark-800 text-gray-900 dark:text-white">
34 <input
35 type="text"
36 name="search"
37 id="search"
38 placeholder={`Ask anything about ${
39 props.version === "Census" ?
40 "US crime, demographics, housing, income..."
41 :
42 "San Francisco crime, drug use, homelessness, demographics, income, bars, restaurants, parks..."
43 }`}
44 className="block w-full rounded-none rounded-l-md border-0 py-1.5 ring-1 ring-inset ring-gray-300 dark:ring-neutral-500 focus:ring-2 focus:ring-inset focus:ring-blue-600 dark:focus:ring-blue-600 text-sm leading-6 bg-transparent dark:placeholder-neutral-400"
45 value={value}
46 onChange={onSearchChange}
47 />
48 <button
49 type="button"
50 className="focus:text-blue-600 hover:text-blue-600 dark:text-white/50 dark:hover:text-blue-600 relative -ml-px inline-flex items-center gap-x-1.5 rounded-r-md p-2 text-sm font-semibold ring-1 ring-inset ring-gray-300 dark:ring-neutral-500 focus:ring-2 focus:ring-inset focus:ring-blue-600 dark:focus:ring-blue-600 focus:outline-none hover:bg-gray-50 hover:dark:bg-dark-900"
51 onClick={onClear}
52 >
53 <FaTimes />
54 </button>
55 </div>
56 <SearchButton />
57 </div>
58 <div className="text-left">
59 {
60 suggestedQuery ?
61 <Suggestion
62 suggestedQuery={suggestedQuery}
63 setTitle={setTitle}
64 fetchBackend={fetchBackend}
65 currentSuggestionId={currentSuggestionId}
66 setQuery={setQuery}
67 />
68 :
69 null
70 }
71 </div>
72 </div>
73 )
74}
75

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected