mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* beacon deposits start * some fixes * test * counters * conflict fix * fix mock
40 lines
986 B
TypeScript
40 lines
986 B
TypeScript
import { Box } from '@chakra-ui/react';
|
|
import React from 'react';
|
|
|
|
import type { DepositsItem } from 'types/api/deposits';
|
|
|
|
import useLazyRenderedList from 'lib/hooks/useLazyRenderedList';
|
|
|
|
import BeaconChainDepositsListItem from './BeaconChainDepositsListItem';
|
|
|
|
type Props = {
|
|
isLoading?: boolean;
|
|
} & ({
|
|
items: Array<DepositsItem>;
|
|
view: 'list' | 'block' | 'address';
|
|
});
|
|
|
|
const DepositsList = ({ items, view, isLoading }: Props) => {
|
|
const { cutRef, renderedItemsNum } = useLazyRenderedList(items, !isLoading);
|
|
|
|
return (
|
|
<Box>
|
|
{ items.slice(0, renderedItemsNum).map((item, index) => {
|
|
|
|
const key = item.index + (isLoading ? String(index) : '');
|
|
return (
|
|
<BeaconChainDepositsListItem
|
|
key={ key }
|
|
item={ item as DepositsItem }
|
|
view={ view }
|
|
isLoading={ isLoading }
|
|
/>
|
|
);
|
|
}) }
|
|
<div ref={ cutRef }/>
|
|
</Box>
|
|
);
|
|
};
|
|
|
|
export default React.memo(DepositsList);
|