empty search handled
This commit is contained in:
parent
8002c195e1
commit
83ec548da0
|
|
@ -28,6 +28,10 @@ const Search = ({ isSmall, isInputFocused, setIsInputFocused }: IProps) => {
|
||||||
dispatch(setSearch(value));
|
dispatch(setSearch(value));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const searchValue = useSelector<RootState, RootState["search"]["value"]>(
|
||||||
|
(state) => state.search.value
|
||||||
|
);
|
||||||
|
|
||||||
// redux
|
// redux
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const inputValue = useSelector<RootState, RootState["search"]["value"]>(
|
const inputValue = useSelector<RootState, RootState["search"]["value"]>(
|
||||||
|
|
@ -44,7 +48,9 @@ const Search = ({ isSmall, isInputFocused, setIsInputFocused }: IProps) => {
|
||||||
className="search"
|
className="search"
|
||||||
onSubmit={(event: React.FormEvent<HTMLFormElement>) => {
|
onSubmit={(event: React.FormEvent<HTMLFormElement>) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
navigate(`/search/${inputValue}`);
|
if (searchValue.length > 0) {
|
||||||
|
navigate(`/search/${inputValue}`);
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
variants={searchMobileMotion}
|
variants={searchMobileMotion}
|
||||||
initial={isSmall ? "borderRest" : {}}
|
initial={isSmall ? "borderRest" : {}}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue