mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
added lab search
This commit is contained in:
parent
16d12f92da
commit
ddf2b6eda3
16 changed files with 149 additions and 28 deletions
|
@ -3,6 +3,7 @@ import React, { FC } from 'react';
|
|||
import Masonry from 'react-masonry-css';
|
||||
|
||||
import { InfiniteScroll } from '~/components/containers/InfiniteScroll';
|
||||
import { LabNoResults } from '~/components/lab/LabNoResults';
|
||||
import { LabNode } from '~/components/lab/LabNode';
|
||||
import { EMPTY_NODE, NODE_TYPES } from '~/constants/node';
|
||||
import { useLabContext } from '~/utils/context/LabContextProvider';
|
||||
|
@ -30,7 +31,7 @@ const LoadingNode = () => (
|
|||
);
|
||||
|
||||
const LabGrid: FC<IProps> = () => {
|
||||
const { isLoading, nodes, hasMore, loadMore } = useLabContext();
|
||||
const { isLoading, nodes, hasMore, loadMore, search, setSearch } = useLabContext();
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
|
@ -52,6 +53,10 @@ const LabGrid: FC<IProps> = () => {
|
|||
);
|
||||
}
|
||||
|
||||
if (search && !nodes.length) {
|
||||
return <LabNoResults resetSearch={() => setSearch('')} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<InfiniteScroll hasMore={hasMore} loadMore={loadMore}>
|
||||
<Masonry
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue