import { DropdownButton } from "./Buttons/DropdownButton"; import { Icons } from "./Icon"; import { TextInputControl } from "./TextInputs/TextInputControl"; import { useState } from "react"; import { MWMediaType, MWQuery } from "scrapers"; export interface SearchBarProps { buttonText?: string; placeholder?: string; onChange: (value: MWQuery) => void; value: MWQuery; } export function SearchBarInput(props: SearchBarProps) { const [dropdownOpen, setDropdownOpen] = useState(false); function setSearch(value: string) { props.onChange({ ...props.value, searchQuery: value, }); } function setType(type: string) { props.onChange({ ...props.value, type: type as MWMediaType, }); } return (
setDropdownOpen((old) => !old)} > {props.buttonText || "Search"}
); }