mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
prevent render null items in grid
This commit is contained in:
@@ -404,15 +404,19 @@ const ListComponent = memo((props: ListChildComponentProps<GridItemProps>) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let i = startIndex; i <= stopIndex + columnCountToAdd; i += 1) {
|
for (let i = startIndex; i <= stopIndex + columnCountToAdd; i += 1) {
|
||||||
items.push(
|
if (i < data.length) {
|
||||||
<div
|
items.push(
|
||||||
className={clsx(styles.itemRow, styles[`gap-${gap}`])}
|
<div
|
||||||
key={`card-${i}-${index}`}
|
className={clsx(styles.itemRow, styles[`gap-${gap}`])}
|
||||||
style={{ '--columns': columns } as CSSProperties}
|
key={`card-${i}-${index}`}
|
||||||
>
|
style={{ '--columns': columns } as CSSProperties}
|
||||||
<ItemCard controls={controls} data={data[i]} itemType={itemType} withControls />
|
>
|
||||||
</div>,
|
<ItemCard controls={controls} data={data[i]} itemType={itemType} withControls />
|
||||||
);
|
</div>,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
items.push(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user