import { locationService } from "../services"; import { useAppSelector } from "../store"; import { memoSpecialTypes } from "../helpers/filter"; import "../less/search-bar.less"; import Icon from "./Icon"; interface Props {} const SearchBar: React.FC = () => { const memoType = useAppSelector((state) => state.location.query?.type); const handleMemoTypeItemClick = (type: MemoSpecType | undefined) => { const { type: prevType } = locationService.getState().query ?? {}; if (type === prevType) { type = undefined; } 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;