mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
getting node results for search
This commit is contained in:
parent
41a35f1490
commit
94ac596b92
15 changed files with 308 additions and 164 deletions
60
src/components/flow/FlowStamp/index.tsx
Normal file
60
src/components/flow/FlowStamp/index.tsx
Normal file
|
@ -0,0 +1,60 @@
|
|||
import React, { FC, useCallback, FormEvent } from 'react';
|
||||
import { IFlowState } from '~/redux/flow/reducer';
|
||||
import { InputText } from '~/components/input/InputText';
|
||||
import { FlowRecent } from '../FlowRecent';
|
||||
import classnames from 'classnames';
|
||||
|
||||
import * as styles from './styles.scss';
|
||||
import * as FLOW_ACTIONS from '~/redux/flow/actions';
|
||||
import { FlowSearchResults } from '../FlowSearchResults';
|
||||
|
||||
interface IProps {
|
||||
recent: IFlowState['recent'];
|
||||
updated: IFlowState['updated'];
|
||||
search: IFlowState['search'];
|
||||
flowChangeSearch: typeof FLOW_ACTIONS.flowChangeSearch;
|
||||
}
|
||||
|
||||
const FlowStamp: FC<IProps> = ({ recent, updated, search, flowChangeSearch }) => {
|
||||
const onSearchChange = useCallback((text: string) => flowChangeSearch({ text }), [
|
||||
flowChangeSearch,
|
||||
]);
|
||||
|
||||
const onSearchSubmit = useCallback((event: FormEvent) => {
|
||||
event.preventDefault();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={styles.wrap}>
|
||||
<form className={styles.search} onSubmit={onSearchSubmit}>
|
||||
<InputText title="Поиск" value={search.text} handler={onSearchChange} />
|
||||
</form>
|
||||
|
||||
<div className={styles.grid}>
|
||||
{search.text ? (
|
||||
<>
|
||||
<div className={styles.label}>
|
||||
<span className={styles.label_text}>Результаты поиска</span>
|
||||
</div>
|
||||
|
||||
<div className={styles.items}>
|
||||
<FlowSearchResults search={search} />
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<div className={styles.label}>
|
||||
<span className={styles.label_text}>Что нового?</span>
|
||||
</div>
|
||||
|
||||
<div className={styles.items}>
|
||||
<FlowRecent updated={updated} recent={recent} />
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export { FlowStamp };
|
Loading…
Add table
Add a link
Reference in a new issue