fix(striker-ui): skip empty keys when building Grid items

main
Tsu-ba-me 2 years ago
parent 06b33273f3
commit f15592f82f
  1. 4
      striker-ui/components/Grid.tsx
  2. 2
      striker-ui/types/Grid.d.ts

@ -13,14 +13,14 @@ const Grid: FC<GridProps> = ({
return items.map(([itemId, itemGridProps], index) => { return items.map(([itemId, itemGridProps], index) => {
const key = itemId; const key = itemId;
return ( return itemGridProps ? (
<MUIGrid <MUIGrid
{...calculateItemBreakpoints(index, key)} {...calculateItemBreakpoints(index, key)}
key={key} key={key}
item item
{...itemGridProps} {...itemGridProps}
/> />
); ) : undefined;
}); });
}, [calculateItemBreakpoints, layout]); }, [calculateItemBreakpoints, layout]);

@ -1,5 +1,5 @@
type GridLayout = { type GridLayout = {
[id: string]: import('@mui/material').GridProps; [id: string]: import('@mui/material').GridProps | undefined;
}; };
type GridOptionalProps = { type GridOptionalProps = {

Loading…
Cancel
Save