|
|
@ -1,9 +1,10 @@ |
|
|
|
import { Grid as MUIGrid } from '@mui/material'; |
|
|
|
import { Box as MUIBox, Grid as MUIGrid } from '@mui/material'; |
|
|
|
import { FC, useMemo } from 'react'; |
|
|
|
import { FC, useMemo } from 'react'; |
|
|
|
|
|
|
|
|
|
|
|
const Grid: FC<GridProps> = ({ |
|
|
|
const Grid: FC<GridProps> = ({ |
|
|
|
calculateItemBreakpoints = () => ({ xs: 1 }), |
|
|
|
calculateItemBreakpoints = () => ({ xs: 1 }), |
|
|
|
layout, |
|
|
|
layout, |
|
|
|
|
|
|
|
wrapperBoxProps, |
|
|
|
...restGridProps |
|
|
|
...restGridProps |
|
|
|
}) => { |
|
|
|
}) => { |
|
|
|
const itemElements = useMemo(() => { |
|
|
|
const itemElements = useMemo(() => { |
|
|
@ -24,9 +25,12 @@ const Grid: FC<GridProps> = ({ |
|
|
|
}, [calculateItemBreakpoints, layout]); |
|
|
|
}, [calculateItemBreakpoints, layout]); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<MUIGrid container {...restGridProps}> |
|
|
|
// Make Grid compatible with FlexBox by adding an extra empty wrapper.
|
|
|
|
{itemElements} |
|
|
|
<MUIBox {...wrapperBoxProps}> |
|
|
|
</MUIGrid> |
|
|
|
<MUIGrid container {...restGridProps}> |
|
|
|
|
|
|
|
{itemElements} |
|
|
|
|
|
|
|
</MUIGrid> |
|
|
|
|
|
|
|
</MUIBox> |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|