Skip to content

Commit

Permalink
fix(Layout): remove accidental props pass to Grid
Browse files Browse the repository at this point in the history
  • Loading branch information
oreqizer committed Nov 30, 2023
1 parent 28fef79 commit e7f47d2
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions packages/orbit-components/src/Layout/index.tsx
Expand Up @@ -15,20 +15,25 @@ const getChildrenProps = (type: Type, key: string) => {
return null;
};

const Layout = ({ children, type, dataTest }: Props) => (
<Grid
{...LAYOUT_SETTINGS[type]}
className="px-md de:p-lg mx-auto my-0 box-border w-full py-0"
dataTest={dataTest}
>
{React.Children.map(children as React.ReactElement<LayoutColumnProps>, (item, key) => {
return React.cloneElement(item, {
...getChildrenProps(type, key.toString()),
...item.props,
});
})}
</Grid>
);
const Layout = ({ children, type, dataTest }: Props) => {
// Removes unwanted props from Grid
const { layoutColumns: _, ...props } = LAYOUT_SETTINGS[type];

return (
<Grid
{...props}
className="px-md de:p-lg mx-auto my-0 box-border w-full py-0"
dataTest={dataTest}
>
{React.Children.map(children as React.ReactElement<LayoutColumnProps>, (item, key) => {
return React.cloneElement(item, {
...getChildrenProps(type, key.toString()),
...item.props,
});
})}
</Grid>
);
};

export default Layout;

Expand Down

0 comments on commit e7f47d2

Please sign in to comment.