import { MWMediaType, MWQuery } from "@/backend/metadata/types"; import { useState } from "react"; import { useTranslation } from "react-i18next"; import { DropdownButton } from "./buttons/DropdownButton"; import { Icon, Icons } from "./Icon"; import { TextInputControl } from "./text-inputs/TextInputControl"; export interface SearchBarProps { buttonText?: string; placeholder?: string; onChange: (value: MWQuery, force: boolean) => void; onUnFocus: () => void; value: MWQuery; } export function SearchBarInput(props: SearchBarProps) { const { t } = useTranslation(); const [dropdownOpen, setDropdownOpen] = useState(false); function setSearch(value: string) { props.onChange( { ...props.value, searchQuery: value, }, false ); } function setType(type: string) { props.onChange( { ...props.value, type: type as MWMediaType, }, true ); } return (