import type { FormEvent } from "react"; import type { SearchResult } from "@/types/api"; type Props = { query: string; searching: boolean; results: SearchResult[]; marketStatus: { isOpen: boolean; status: string; time: string }; onChangeQuery: (value: string) => void; onSubmit: (event: FormEvent) => void; onSelectTicker: (symbol: string) => void; }; export function TopBar({ query, searching, results, marketStatus, onChangeQuery, onSubmit, onSelectTicker }: Props) { const showDropdown = query.trim().length >= 2; return (
onChangeQuery(event.target.value)} placeholder="Search ticker or company" aria-label="Search ticker" /> Enter {showDropdown ? (
{searching ?
Searching...
: null} {!searching && results.length === 0 ?
No matches
: null} {!searching ? results.map((result) => ( )) : null}
) : null}
{marketStatus.status} {marketStatus.time}
T Local Profile
); }