import { ChangeEvent, FormEvent, useState } from "react"; import { BiSlider, BiTimeFive } from "react-icons/bi"; import { VuiFlexContainer, VuiFlexItem, VuiSearchInput, VuiSpacer, VuiTitle, VuiIcon, VuiButtonSecondary, VuiLink } from "../../ui"; import { useConfigContext } from "../../contexts/ConfigurationContext"; import { useSearchContext } from "../../contexts/SearchContext"; import { HistoryDrawer } from "./HistoryDrawer"; import { OptionsDrawer } from "./OptionsDrawer"; import "./searchControls.scss"; type Props = { hasQuery: boolean; }; export const SearchControls = ({ hasQuery }: Props) => { const { app } = useConfigContext(); const { searchValue, setSearchValue, onSearch, reset } = useSearchContext(); const [isOptionsOpen, setIsOptionsOpen] = useState(false); const [isHistoryOpen, setIsHistoryOpen] = useState(false); const onSearchChange = (event: ChangeEvent) => { setSearchValue(event.target.value); }; const onSearchSubmit = async (event: FormEvent) => { event.preventDefault(); onSearch({ value: searchValue }); }; return ( <>

{app.title}

setIsOptionsOpen(!isOptionsOpen)} icon={ } > Options setIsHistoryOpen(!isHistoryOpen)} icon={ } > History
{hasQuery && ( reset()}> Start over )}
setIsHistoryOpen(false)} /> setIsOptionsOpen(false)} /> ); };