import { useContext } from "react"; import appContext from "../stores/appContext"; import { locationService } from "../services"; import { memoSpecialTypes } from "../helpers/filter"; import "../less/search-bar.less"; interface Props {} const SearchBar: React.FC = () => { const { locationState: { query: { type: memoType }, }, } = useContext(appContext); const handleMemoTypeItemClick = (type: MemoSpecType | "") => { const { type: prevType } = locationService.getState().query; if (type === prevType) { type = ""; } locationService.setMemoTypeQuery(type); }; const handleTextQueryInput = (event: React.FormEvent) => { const text = event.currentTarget.value; locationService.setTextQuery(text); }; return (

QUICKLY FILTER

Type:
{memoSpecialTypes.map((t, idx) => { return (
{ handleMemoTypeItemClick(t.value as MemoSpecType); }} > {t.text} {idx + 1 < memoSpecialTypes.length ? / : null}
); })}
); }; export default SearchBar;