Improve grid size, language

This commit is contained in:
Kendall Garner 2024-02-16 21:42:15 -08:00
parent ce9c03b0e1
commit 2f105956b9
No known key found for this signature in database
GPG key ID: 18D2767419676C87
6 changed files with 43 additions and 21 deletions

View file

@ -72,7 +72,7 @@ export const VirtualInfiniteGrid = forwardRef(
const [itemData, setItemData] = useState<any[]>(fetchInitialData?.() || []);
const { itemHeight, rowCount, columnCount } = useMemo(() => {
const itemsPerRow = width ? Math.floor(width / itemSize) : 5;
const itemsPerRow = width ? Math.floor(width / (itemSize + itemGap * 2)) : 5;
const widthPerItem = Number(width) / itemsPerRow;
const itemHeight = widthPerItem + cardRows.length * 26;
@ -81,7 +81,7 @@ export const VirtualInfiniteGrid = forwardRef(
itemHeight,
rowCount: Math.ceil(itemCount / itemsPerRow),
};
}, [cardRows.length, itemCount, itemSize, width]);
}, [cardRows.length, itemCount, itemGap, itemSize, width]);
const isItemLoaded = useCallback(
(index: number) => {