mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
fixed lab infinite scroll
This commit is contained in:
parent
de4207ab63
commit
f7cd6316f5
4 changed files with 103 additions and 23 deletions
|
@ -11,27 +11,26 @@ import styles from './styles.module.scss';
|
|||
interface IProps {}
|
||||
|
||||
const LabGrid: FC<IProps> = memo(() => {
|
||||
const { nodes, hasMore, loadMore, search, setSearch } = useLabContext();
|
||||
const { nodes, hasMore, loadMore, search, setSearch, isLoading } =
|
||||
useLabContext();
|
||||
|
||||
if (search && !nodes.length) {
|
||||
return <LabNoResults resetSearch={() => setSearch('')} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<InfiniteScroll hasMore={hasMore} loadMore={loadMore}>
|
||||
<div className={styles.wrap}>
|
||||
<Columns>
|
||||
{nodes.map((node) => (
|
||||
<LabNode
|
||||
node={node.node}
|
||||
key={node.node.id}
|
||||
lastSeen={node.last_seen}
|
||||
commentCount={node.comment_count}
|
||||
/>
|
||||
))}
|
||||
</Columns>
|
||||
</div>
|
||||
</InfiniteScroll>
|
||||
<div className={styles.wrap}>
|
||||
<Columns hasMore={hasMore && !isLoading} onScrollEnd={loadMore}>
|
||||
{nodes.map((node) => (
|
||||
<LabNode
|
||||
node={node.node}
|
||||
key={node.node.id}
|
||||
lastSeen={node.last_seen}
|
||||
commentCount={node.comment_count}
|
||||
/>
|
||||
))}
|
||||
</Columns>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue