import { useTranslation } from "react-i18next"; import { locationService } from "../services"; import { useAppSelector } from "../store"; import { memoSpecialTypes } from "../helpers/filter"; import Icon from "./Icon"; import "../less/search-bar.less"; const SearchBar = () => { const { t } = useTranslation(); 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 (

{t("search.quickly-filter").toUpperCase()}

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