import CircleQuestionMark from 'lucide-solid/icons/circle-question-mark'; import type { JSX } from 'solid-js'; import { createSignal, createUniqueId, For, Match, Show, Switch } from 'solid-js'; import { promptText, unknownPromptsText } from '@/lib/search'; import type { OpportunitySearchResults } from '@/primitives/createOpportunitySearch'; import { input, linkButton } from './styles'; interface Props { /** The box's text. */ value: string; onInput: (value: string) => void; search: OpportunitySearchResults; } const helpButton = 'flex rounded-md border border-line bg-surface p-1 text-ink hover:border-muted aria-expanded:border-ink'; const helpTerm = 'font-mono text-[13px] whitespace-nowrap'; /** * The general search box, with its help (from the backend, behind the "?" * button), a note on prompts the search ignored, and the search's errors. */ export function SearchField(props: Props): JSX.Element { const inputId = createUniqueId(); const helpId = createUniqueId(); const noteId = createUniqueId(); const [isHelpOpen, setIsHelpOpen] = createSignal(false); const unknownPrompts = (): string => { const unknown = props.search.unknownPrompts(); return unknown.length === 0 ? '' : unknownPromptsText(unknown, props.search.help()?.prompts ?? []); }; return (
props.onInput(e.currentTarget.value)} aria-describedby={noteId} aria-busy={props.search.isSearching() || undefined} /> {(err) => ( )}

{unknownPrompts()}

); }