1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00

removed search reducer completely

This commit is contained in:
Fedor Katurov 2022-01-04 15:51:44 +07:00
parent 38eedab3c2
commit b82ccfb786
22 changed files with 146 additions and 570 deletions

View file

@ -21,11 +21,11 @@ interface IProps {
const FlowStamp: FC<IProps> = ({ isFluid, onToggleLayout }) => {
const {
searchText,
searchTotal,
hasMore: searchHasMore,
searchIsLoading,
searchResults,
onSearchChange,
onSearchLoadMore,
setSearchText,
loadMore: onSearchLoadMore,
} = useSearchContext();
const { recent, updates } = useFlowContext();
@ -34,7 +34,7 @@ const FlowStamp: FC<IProps> = ({ isFluid, onToggleLayout }) => {
event.preventDefault();
}, []);
const onClearSearch = useCallback(() => onSearchChange(''), [onSearchChange]);
const onClearSearch = useCallback(() => setSearchText(''), [setSearchText]);
const onKeyUp = useCallback(
event => {
@ -61,7 +61,7 @@ const FlowStamp: FC<IProps> = ({ isFluid, onToggleLayout }) => {
<InputText
title="Поиск"
value={searchText}
handler={onSearchChange}
handler={setSearchText}
after={after}
onKeyUp={onKeyUp}
/>
@ -73,11 +73,11 @@ const FlowStamp: FC<IProps> = ({ isFluid, onToggleLayout }) => {
<div className={styles.label}>
<span className={styles.label_text}>Результаты поиска</span>
<span className="line" />
<span>{!searchIsLoading && searchTotal}</span>
</div>
<div className={styles.items}>
<FlowSearchResults
hasMore={searchHasMore}
isLoading={searchIsLoading}
results={searchResults}
onLoadMore={onSearchLoadMore}