mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
made lab use provider and context
This commit is contained in:
parent
cb314e9f8d
commit
96f1529f2b
9 changed files with 129 additions and 56 deletions
|
@ -4,14 +4,10 @@ import styles from './styles.module.scss';
|
|||
import { LabNode } from '~/components/lab/LabNode';
|
||||
import { EMPTY_NODE, NODE_TYPES } from '~/redux/node/constants';
|
||||
import { values } from 'ramda';
|
||||
import { ILabNode } from '~/redux/lab/types';
|
||||
import { useLabPagination } from '~/utils/hooks/lab/useLabPagination';
|
||||
import { useLabContext } from '~/utils/context/LabContextProvider';
|
||||
|
||||
interface IProps {
|
||||
isLoading: boolean;
|
||||
nodes: ILabNode[];
|
||||
onLoadMore: () => void;
|
||||
}
|
||||
interface IProps {}
|
||||
|
||||
const breakpointCols = {
|
||||
default: 2,
|
||||
|
@ -30,7 +26,9 @@ const LoadingNode = () => (
|
|||
/>
|
||||
);
|
||||
|
||||
const LabGrid: FC<IProps> = ({ isLoading, nodes, onLoadMore }) => {
|
||||
const LabGrid: FC<IProps> = () => {
|
||||
const { isLoading, nodes, onLoadMore } = useLabContext();
|
||||
|
||||
const columns = useMemo(() => Array.from(document.querySelectorAll(`.${styles.column}`)), []);
|
||||
|
||||
useLabPagination(isLoading, columns, onLoadMore);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue